程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> 關於Oracle數據庫 >> OracleDataGuard_主庫重命名數據文件

OracleDataGuard_主庫重命名數據文件

編輯:關於Oracle數據庫

       8.3.4 Renaming a Datafile in the Primary Database

      8.3.4 在主庫中重命令數據文件(即手動在備庫修改相等的變化)

      When you rename one or more datafiles in the primary database, the change is not propagated to the standby database. Therefore, if you want to rename the same datafiles on the standby database, you must manually make the equivalent modifications on the standby database because the modifications are not performed automatically, even if the STANDBY_FILE_MANAGEMENT initialization parameter is set to AUTO.

      當你在主庫中重命名一個或多個數據文件時,備庫是不會發生相應的變化的。因此,如果你想在備庫重命名相同的數據文件,你必須手動在備庫中做相等的修改。因為這些改變不是自動的,甚至STANDBY_FILE_MANAGEMENT設置為AUTO也不會發生改變的。

      The following steps describe how to rename a datafile in the primary database and manually propagate the changes to the standby database.

      按照以下描述來在主庫重命名數據文件,而手動將這些改變傳播到備庫中去。

      To rename the datafile in the primary database, take the tablespace offline:

      1.在主庫中重命名數據文件,先將表空間脫機:

      SQL> ALTER TABLESPACE tbs_4 OFFLINE;

      Exit from the SQL prompt and issue an operating system command, such as the following UNIX mv command, to rename the datafile on the primary system:

      退出SQL提示符,使用操作系統命令,像unix的mv命令,在主庫操作系統上重命名數據文件:

      % mv /disk1/oracle/oradata/payroll/tbs_4.dbf /disk1/oracle/oradata/payroll/tbs_x.dbf

      Rename the datafile in the primary database and bring the tablespace back online:

      在主庫上發出以下命令來重命名數據文件,然後將表空間聯機:

      SQL> ALTER TABLESPACE tbs_4 RENAME DATAFILE 2> '/disk1/oracle/oradata/payroll/tbs_4.dbf' 3> TO'/disk1/oracle/oradata/payroll/tbs_x.dbf'; SQL> ALTER TABLESPACE tbs_4 ONLINE;

      Connect to the standby database, query the V$ARCHIVED_LOG view to verify all of the archived redo log files are applied, and then stop Redo Apply:

      連接備庫,查詢V$ARCHIVED_LOG 視圖來驗證所有的歸檔日志已經應用,然後停止重做應用:

      SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#; SEQUENCE# APP --------- --- 8 YES 9 YES 10 YES 11 YES 4 rows selected. SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

      Shut down the standby database:

      5.關閉備庫

      SQL> SHUTDOWN;

      Rename the datafile at the standby site using an operating system command, such as the UNIX mv command:

      6.在備庫的操作環境使用操作系統命令,如UNIX的mv命令,來重命名數據文件:

      % mv /disk1/oracle/oradata/payroll/tbs_4.dbf /disk1/oracle/oradata/payroll/tbs_x.dbf

      Start and mount the standby database:

      7.啟動並裝載備庫:

      SQL> STARTUP MOUNT;

      Rename the datafile in the standby control file. Note that the STANDBY_FILE_MANAGEMENT initialization parameter must be set to MANUAL.

      在備庫上重命名數據文件到控制文件裡,注意:STANDBY_FILE_MANAGEMENT初始化參數必須設置為MANUAL

      SQL> ALTER DATABASE RENAME FILE '/disk1/oracle/oradata/payroll/tbs_4.dbf' 2> TO '/disk1/oracle/oradata/payroll/tbs_x.dbf';

      On the standby database, restart Redo Apply:

      9.在備庫重新啟動重做應用:

      SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE 2> DISCONNECT FROM SESSION;

      If you do not rename the corresponding datafile at the standby system, and then try to refresh the standby database control file, the standby database will attempt to use the renamed datafile, but it will not find it. Consequently, you will see error messages similar to the following in the alert log:

      如果你沒有在備庫重命名相應的數據文件,那麼試著刷新備庫控制文件時,備庫會嘗試使用已命名的數據文件,但是找不到它。因此,你會在告警日志看到如下相似的錯誤信息:

      ORA-00283: recovery session canceled due to errors ORA-01157: cannot identify/lock datafile 4 - see DBWR trace file ORA-01110: datafile 4: '/Disk1/oracle/oradata/payroll/tbs_x.dbf'

    1. 上一頁:
    2. 下一頁:
    Copyright © 程式師世界 All Rights Reserved