時間:2015-06-28 00:00:00 來源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評論(0)
1.用oracle自帶的工具nid改數(shù)據(jù)庫名
在本例中,假設(shè)原來的數(shù)據(jù)庫名為test,要改成testdb,原實例名(service_name,instance_name)test,要改成testdb.
nid是自帶的工具,在oracle_home/bin目錄中.以下方法假設(shè)登陸到數(shù)據(jù)庫本機做。
1.1 sqlplus "sys/password as sysdba"
1.2 sql>shutdown immediate --先停掉數(shù)據(jù)庫
1.3 sql>startup mount --nid需要在mount狀態(tài)下才能做。
1.4sql>host nid target=sys/password dbname=new_dbname --nid是一個在操作系統(tǒng)下執(zhí)行的命令,在sqlplus環(huán)境中用host 去調(diào)用操作系統(tǒng)環(huán)境下的命令。命令中,當你想將數(shù)據(jù)庫名字改為TESTDB時,應(yīng)寫成dbname=testdb
1.5執(zhí)行后程序會詢問:
Change database ID and database name TEST to TESTDB? (Y/[N]) =>y
敲y確定。
之后程序會對控制文件,數(shù)據(jù)文件進行修改:
Control File C:ORACLEORADATATESTCONTROL01.CTL - modified
Control File C:ORACLEORADATATESTCONTROL02.CTL - modified
Control File C:ORACLEORADATATESTCONTROL03.CTL - modified
Datafile C:ORACLEORADATATEST YSTEM01.DBF - dbid changed, wrote new name
Datafile C:ORACLEORADATATESTUNDOTBS01.DBF - dbid changed, wrote new nam
Datafile C:ORACLEORADATATESTINDX01.DBF - dbid changed, wrote new name
Datafile C:ORACLEORADATATESTTOOLS01.DBF - dbid changed, wrote new name
Datafile C:ORACLEORADATATESTUSERS01.DBF - dbid changed, wrote new name
Datafile D:DATAFILEPORMALS_SPA.DBF - dbid changed, wrote new name
Datafile C:ORACLEORADATATESTOEM_REPOSITORY.DBF - dbid changed, wrote ne
name
Datafile D:DATAFILEPORMALS_SPA_01.DBF - dbid changed, wrote new name
Datafile C:ORACLEORADATATESTTEMP01.DBF - dbid changed, wrote new name
Control File C:ORACLEORADATATESTCONTROL01.CTL - dbid changed, wrote new
name
Control File C:ORACLEORADATATESTCONTROL02.CTL - dbid changed, wrote new
name
Control File C:ORACLEORADATATESTCONTROL03.CTL - dbid changed, wrote new
name
Database name changed to TESTDB.
Modify parameter file and generate a new password file before restarting.
Database ID for database TESTDB changed to 2321050327.
All previous backups and archived redo logs for this database are unusable.
Shut down database and open with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
關(guān)鍵詞標簽:oracle,數(shù)據(jù)庫
相關(guān)閱讀
熱門文章 Oracle中使用alter table來增加,刪除,修改列的語法 oracle中使用SQL語句修改字段類型-oracle修改SQL語句案例 誤刪Oracle數(shù)據(jù)庫實例的控制文件 為UNIX服務(wù)器設(shè)置Oracle全文檢索
人氣排行 oracle中使用SQL語句修改字段類型-oracle修改SQL語句案例 Oracle中使用alter table來增加,刪除,修改列的語法 ORACLE SQL 判斷字符串是否為數(shù)字的語句 ORACLE和SQL語法區(qū)別歸納(1) oracle grant 授權(quán)語句 ORACLE修改IP地址后如何能夠使用 如何加速Oracle大批量數(shù)據(jù)處理 Oracle刪除表的幾種方法