Linux環境下oracle數庫庫改名,例項改名
Linux環境下oracle數庫庫改名,例項改名
轉自:http://seteor.itpub.net/post/42575/502279
SQL> select instance_name from v$instance; --檢視當前例項名
INSTANCE_NAME
----------------
test
SQL> select name from v$database; --檢視當前dbname
NAME
---------
TEST
SQL> shutdown immediate --關閉資料庫
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 205520896 bytes
Fixed Size 1218532 bytes
Variable Size 67110940 bytes
Database Buffers 134217728 bytes
Redo Buffers 2973696 bytes
Database mounted.
DBNEWID: Release 10.2.0.1.0 - Production on Wed Jul 21 16:31:20 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database TESTORA (DBID=547002923)
Connected to server version 10.2.0
Control Files in database:
/u01/oradata/oratest/control01.ctl
/u01/oradata/oratest/control02.ctl
/u01/oradata/oratest/control03.ctl
Change database ID and database name TESTORA to TEST? (Y/[N]) => y --程式詢問
Proceeding with operation
Changing database ID from 547002923 to 2023088600
Changing database name from TESTORA to TEST2
Control File /u01/oradata/oratest/control01.ctl - modified
Control File /u01/oradata/oratest/control02.ctl - modified
Control File /u01/oradata/oratest/control03.ctl - modified
Datafile /u01/oradata/oratest/system01.dbf - dbid changed, wrote new name
Datafile /u01/oradata/oratest/undotbs01.dbf - dbid changed, wrote new name
Datafile /u01/oradata/oratest/sysaux01.dbf - dbid changed, wrote new name
Datafile /u01/oradata/oratest/users01.dbf - dbid changed, wrote new name
Datafile /u01/oradata/oratest/test.dbf - dbid changed, wrote new name
Datafile /u01/oradata/oratest/temp02.dbf - dbid changed, wrote new name
Control File /u01/oradata/oratest/control01.ctl - dbid changed, wrote new name
Control File /u01/oradata/oratest/control02.ctl - dbid changed, wrote new name
Control File /u01/oradata/oratest/control03.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to TEST2.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST changed to 2023088600.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
SQL> alter system set db_name=test2 scope=spfile; --因為dbname已更改,連線丟失,需重新連線
alter system set db_name=test2 scope=spfile
*
ERROR at line 1:
ORA-03135: connection lost contact --因為dbname已更改,連線丟失,需重新連線
SQL> startup mount
ORACLE instance started.
Total System Global Area 205520896 bytes
Fixed Size 1218532 bytes
Variable Size 67110940 bytes
Database Buffers 134217728 bytes
Redo Buffers 2973696 bytes
ORA-01103: database name 'TEST2' in control file is not 'TEST' --庫名已改為test2,但當前啟動的資料庫的spfile還是'TEST'
SQL> alter system set db_name=test2 scope=spfile; --spfile中改為test2
System altered.
SQL> shutdown immediate; --更改db_name後關閉資料庫
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount --重新mount,沒有再報ORA-01103錯誤ORACLE instance started.
Total System Global Area 205520896 bytes
Fixed Size 1218532 bytes
Variable Size 67110940 bytes
Database Buffers 134217728 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter database open resetlogs; --resetlogs
Database altered.
SQL> select dbid,name from v$database; --驗證新的dbid和name
DBID NAME
---------- ---------
808938177 TEST2
SQL> select instance_name from v$instance; --例項名仍然未變化(如果不需要改例項名也可以,如果不改sid,只需更改)
INSTANCE_NAME
----------------
test
----------------------------------------------------------------------------改sid----------------------------------------------------------------
SQL> host orapwd file=/u01/oracle/product/10.2.0/db_1/dbs/orapwtest2 password=123 entries=10; --生成新SID對應的密碼檔案
SQL> create pfile='/u01/oracle/product/10.2.0/db_1/dbs/inittest2.ora' from spfile; --生成新SID對應的pfile檔案
File created.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
另開一終端修改.bash_profile檔案中的ORACLE_SID
[oracle@wwnode2 ~]$ source .bash_profile; --修改後立刻生效
[oracle@wwnode2 ~]$ echo $ORACLE_SID --驗證是否更改成功test2
[oracle@wwnode2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jul 21 16:51:28 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 205520896 bytes
Fixed Size 1218532 bytes
Variable Size 62916636 bytes
Database Buffers 138412032 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> select instance_name from v$instance; --驗證SID
INSTANCE_NAME
----------------
test2
SQL> select name from v$database; --驗證dbname
NAME
---------
TEST2
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14663377/viewspace-1035486/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORACLE-LINUX環境字元介面單例項安裝OracleLinux字元單例
- oracle資料庫與oracle例項Oracle資料庫
- Win環境至Linux環境Oracle資料庫遷移全過程LinuxOracle資料庫
- Linux 環境下安裝 Nexus 私服儲存庫Linux
- oracle資料庫跨平臺(AIX)從RAC恢復至(linux)下的單例項Oracle資料庫AILinux單例
- oracle資料庫建立資料庫例項-九五小龐Oracle資料庫
- steam怎麼改名字 steam改名字-118怎麼解決
- win10 分盤如何改名_win10系統盤如何改名Win10
- 【資料庫資料恢復】LINUX環境下ORACLE資料庫誤刪除的資料恢復資料庫資料恢復LinuxOracle
- linux 環境下 elasticsearch 及 python 相關庫的使用LinuxElasticsearchPython
- bilibili動畫下載視訊批量改名(python)動畫Python
- python環境連結Oracle資料庫PythonOracle資料庫
- webservice修改名稱空間Web
- [20191021]改名與namespace.txtnamespace
- Oracle 例項和RAC叢集下資料庫日誌目錄合集Oracle資料庫
- 純終端Linux環境或者無掛載顯示卡Linux環境執行Chrome例項LinuxChrome
- 8.4linux定時任務-環境變數-資料庫Linux變數資料庫
- SpringCloudConfig環境庫SpringGCCloud
- Oracle 11G資料庫單例項安裝Oracle資料庫單例
- [Oracle] -- 配置Oracle環境變數Oracle變數
- linux環境下解除安裝oracle11gLinuxOracle
- 在 Homestead 環境下為 PHP 新增 Oracle 資料庫擴充套件(OCI)PHPOracle資料庫套件
- Linux下Java環境變數的配置LinuxJava變數
- 如何在Linux系統中設定Boost庫的環境變數?Linux變數
- 刪除linux下的oracle資料庫LinuxOracle資料庫
- mv 命令 – 移動或改名檔案
- sra 資料轉成 fastq並改名AST
- ES6 解構賦值+改名賦值
- 傳奇人物線上改名指令碼指令碼
- oracle 11g 單例項資料庫的安裝Oracle單例資料庫
- Windows環境下,.lib匯入庫 詳解Windows
- Visual Studio部署C++環境下OpenCV庫C++OpenCV
- Mac環境下安裝MongoDB資料庫MacMongoDB資料庫
- Linux環境下的Mysql資料庫入門-基於Centos系統LinuxMySql資料庫CentOS
- Linux環境下:程式的連結, 裝載和庫[靜態連結]Linux
- vmware虛擬機器更改名字虛擬機
- [20221010]使用toad管理索引改名問題.txt索引
- Linux環境下:程式的連結, 裝載和庫[ELF檔案詳解]Linux
- 達夢資料庫DM8在LINUX環境下安裝步驟資料庫Linux