更改資料庫DBID
當克隆一個資料庫到另外一臺機器上,具有相同的資料庫名稱或者如果一個新的資料庫名稱是透過重建的控制檔案,
那麼需要改變DBBID,特別是如果是新的資料庫在相同的rman catalog是註冊。
尤其是如果使用rman catalog,rman catalog中只允許註冊一個DBID,相同DBID不能註冊在同一catalog當中,下面演示改變DBID:
1、關閉資料庫,啟動到mount狀態
SYS@jzh>shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@jzh>startup mount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 444597592 bytes
Database Buffers 176160768 bytes
Redo Buffers 3338240 bytes
Database mounted.
2、確認sys使用者可以連線
[oracle@jzh5 ~]$ sqlplus sys/oracle@jzh as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Sep 13 08:43:52 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
3、更改DBID
[oracle@jzh5 ~]$ cd $ORACLE_HOME/bin
[oracle@jzh5 bin]$ ./nid target=sys/oracle@jzh
DBNEWID: Release 11.2.0.3.0 - Production on Sun Sep 13 08:45:08 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to database JZH (DBID=233255254)----當前資料庫DBID
Connected to server version 11.2.0
Control Files in database:
/u01/app/oracle/oradata/jzh/control01.ctl
/u01/app/oracle/fast_recovery_area/jzh/control02.ctl
Change database ID of database JZH? (Y/[N]) => y----是否更改DBID,輸入Y
Proceeding with operation
Changing database ID from 233255254 to 249044244 -----DBID從233255254更改為249044244
Control File /u01/app/oracle/oradata/jzh/control01.ctl - modified
Control File /u01/app/oracle/fast_recovery_area/jzh/control02.ctl - modified
Datafile /u01/app/oracle/oradata/jzh/system01.db - dbid changed
Datafile /u01/app/oracle/oradata/jzh/sysaux01.db - dbid changed
Datafile /u01/app/oracle/oradata/jzh/undotbs01.db - dbid changed
Datafile /u01/app/oracle/oradata/jzh/users01.db - dbid changed
Datafile /u01/app/oracle/oradata/jzh/test01.db - dbid changed
Datafile /u01/app/oracle/oradata/jzh/temp01.db - dbid changed
Control File /u01/app/oracle/oradata/jzh/control01.ctl - dbid changed
Control File /u01/app/oracle/fast_recovery_area/jzh/control02.ctl - dbid changed
Instance shut down
Database ID for database JZH changed to 249044244.
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.----資料庫被shutdown,以resetlogs開啟。
Succesfully changed database ID.
DBNEWID - Completed succesfully.
4、開啟資料庫
SYS@jzh>startup mount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 444597592 bytes
Database Buffers 176160768 bytes
Redo Buffers 3338240 bytes
Database mounted.
SYS@jzh>alter database open resetlogs;
Database altered.
5、檢查新的DBID
[oracle@jzh5 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Sun Sep 13 08:50:45 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: JZH (DBID=249044244)----新的DBID
由於更改DBID會導致以前的備份失效,因此在更改DBID時還需要慎重考慮。
那麼需要改變DBBID,特別是如果是新的資料庫在相同的rman catalog是註冊。
尤其是如果使用rman catalog,rman catalog中只允許註冊一個DBID,相同DBID不能註冊在同一catalog當中,下面演示改變DBID:
1、關閉資料庫,啟動到mount狀態
SYS@jzh>shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@jzh>startup mount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 444597592 bytes
Database Buffers 176160768 bytes
Redo Buffers 3338240 bytes
Database mounted.
2、確認sys使用者可以連線
[oracle@jzh5 ~]$ sqlplus sys/oracle@jzh as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Sep 13 08:43:52 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
3、更改DBID
[oracle@jzh5 ~]$ cd $ORACLE_HOME/bin
[oracle@jzh5 bin]$ ./nid target=sys/oracle@jzh
DBNEWID: Release 11.2.0.3.0 - Production on Sun Sep 13 08:45:08 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to database JZH (DBID=233255254)----當前資料庫DBID
Connected to server version 11.2.0
Control Files in database:
/u01/app/oracle/oradata/jzh/control01.ctl
/u01/app/oracle/fast_recovery_area/jzh/control02.ctl
Change database ID of database JZH? (Y/[N]) => y----是否更改DBID,輸入Y
Proceeding with operation
Changing database ID from 233255254 to 249044244 -----DBID從233255254更改為249044244
Control File /u01/app/oracle/oradata/jzh/control01.ctl - modified
Control File /u01/app/oracle/fast_recovery_area/jzh/control02.ctl - modified
Datafile /u01/app/oracle/oradata/jzh/system01.db - dbid changed
Datafile /u01/app/oracle/oradata/jzh/sysaux01.db - dbid changed
Datafile /u01/app/oracle/oradata/jzh/undotbs01.db - dbid changed
Datafile /u01/app/oracle/oradata/jzh/users01.db - dbid changed
Datafile /u01/app/oracle/oradata/jzh/test01.db - dbid changed
Datafile /u01/app/oracle/oradata/jzh/temp01.db - dbid changed
Control File /u01/app/oracle/oradata/jzh/control01.ctl - dbid changed
Control File /u01/app/oracle/fast_recovery_area/jzh/control02.ctl - dbid changed
Instance shut down
Database ID for database JZH changed to 249044244.
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.----資料庫被shutdown,以resetlogs開啟。
Succesfully changed database ID.
DBNEWID - Completed succesfully.
4、開啟資料庫
SYS@jzh>startup mount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 444597592 bytes
Database Buffers 176160768 bytes
Redo Buffers 3338240 bytes
Database mounted.
SYS@jzh>alter database open resetlogs;
Database altered.
5、檢查新的DBID
[oracle@jzh5 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Sun Sep 13 08:50:45 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: JZH (DBID=249044244)----新的DBID
由於更改DBID會導致以前的備份失效,因此在更改DBID時還需要慎重考慮。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10271187/viewspace-1798516/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL 更改資料庫資料儲存目錄MySql資料庫
- Postgresql10資料庫之更改資料庫的名稱SQL資料庫
- Ubuntu 上更改 MySQL 資料庫資料儲存目錄UbuntuMySql資料庫
- Django中更改預設資料庫為mysqlDjango資料庫MySql
- Linux CentOS更改MySQL資料庫目錄位置LinuxCentOSMySql資料庫
- 7.55 CON_DBID_TO_ID
- ADFS 部署資料庫AlwaysOn後應用端的連線字串更改資料庫字串
- 歸檔路徑更改後,如何對資料庫進行恢復(轉)資料庫
- mybatis(問題1):更改操作執行了,資料庫中卻未執行MyBatis資料庫
- [20200407]nid修改DBID還原.txt
- [20211112]SYS_CONTEXT ('USERENV','DBID').txtContext
- 如何更改win10資料夾圖示_win10更改資料夾圖示的方法Win10
- [20181119]firefox更改快取資料夾.txtFirefox快取
- 資料更改事件的三種型別事件型別
- 更改資料檔案路徑的方法
- oracle 更改分割槽表資料 ora-14402Oracle
- 資料庫PostrageSQL-管理資料庫資料庫SQL
- 【資料庫資料恢復】SAP資料庫資料恢復案例資料庫資料恢復
- 【資料庫資料恢復】MS SQL資料庫附加資料庫出錯怎麼恢復資料?資料庫資料恢復SQL
- 資料庫介紹--初識資料庫資料庫
- 資料庫 資料庫的完整性資料庫
- 資料湖 vs 倉庫 vs 資料庫資料庫
- 資料庫概論 (一)資料庫概念資料庫
- 【Falsk 使用資料庫】---- 資料庫基本操作資料庫
- 【資料庫資料恢復】Sql Server資料庫資料恢復案例資料庫資料恢復SQLServer
- DataX將MySql資料庫資料同步到Oracle資料庫MySql資料庫Oracle
- 資料夾圖示更改軟體Folder Icons for MacMac
- 織夢資料庫_織夢還原資料庫_織夢資料庫很卡資料庫
- 生產資料庫、開發資料庫、測試資料庫中的資料的區分資料庫
- 資料庫資料庫
- L10資料庫——資料庫介紹資料庫
- Oracle資料庫-----資料庫的基本概念Oracle資料庫
- 【資料庫設計】資料庫的設計資料庫
- oracle 備份資料庫,匯出資料庫Oracle資料庫
- 【資料庫】資料庫儲存過程(一)資料庫儲存過程
- 國產資料庫源流史:AntDB資料庫資料庫
- 資料庫與資料庫管理系統概述資料庫
- 實時資料庫與時序資料庫資料庫
- NoSQL資料庫概念與NoSQL資料庫家族SQL資料庫