Oracle 11g uses slave backup to restore the standby Database

Source: Internet
Author: User

Oracle 11g uses slave backup to restore the standby Database

Oracle 11g uses slave backup to restore the standby Database

1. Start backing up the slave Database
First, check the path of the control file, redo, undo file, and data file.

1.1 disable the archive log transmission of the master database first
SQL> ALTER system SETlog_archive_dest_state_2 = 'defer ';

 

System altered.

SQL>

1.2 close the standby database first
SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

SQL>

1.3 begin rolling backup
# Create a producer Backup Directory

Mkdir/data/oracle_cold/

Start prepare backup control file

Cp/data/oracle_cold/

Cp/home/oradata/orcl/control01.ctlcontrol01. ctl

Cp/oracle/app/oracle/flash_recovery_area/orcl/control02.ctlcontrol02. ctl

Start to restore the redo and undo files.

Mkdir orcl_2

Cp-r/home/oradata/orcl/*. log orcl_2

Start prepare to back up data files

Cp-r/home/oradata/orcl/*. dbf orcl_2

2. Start Using Snapshot Backup for db recovery
2.1. Stop the standby database.
SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

SQL>

2.2. overwrite the current control file
View the original control file directory

[Oracle @ localhost oracle_cold] $ morecontrolfile. log

SQL> SELECT name FROMv $ controlfile;

NAME

--------------------------------------------------------------------------------

/Home/oradata/orcl/control01.ctl

/Oracle/app/oracle/flash_recovery_area/orcl/control02.ctl

SQL>

Start copying Overwrite

[Oracle @ localhost oracle_cold] $ cpcontrol02.ctl/oracle/app/oracle/flash_recovery_area/orcl/control02.ctl

[Oracle @ localhost oracle_cold] $ cpcontrol01.ctl/home/oradata/orcl/control01.ctl

[Oracle @ localhost oracle_cold] $

2.3. overwrite the redo and undo files in the slave backup to the previous directory.
View previous redo and undo file paths

[Oracle @ localhost oracle_cold] $ morelogfile. log

SQL> select member from v $ logfile;

MEMBER

--------------------------------------------------------------------------------

/Home/oradata/orcl/redo03.log

/Home/oradata/orcl/redo02.log

/Home/oradata/orcl/redo01.log

/Home/oradata/orcl/redo_dg_01.log

/Home/oradata/orcl/redo_dg_02.log

/Home/oradata/orcl/redo_dg_03.log

6 rows selected.

SQL>

Start overwriting redo and undo files

[Oracle @ localhost oracle_cold] $ cp orcl_2/*. log/home/oradata/orcl/

[Oracle @ localhost oracle_cold] $

2.4. overwrite the data file in the slave database to the previous directory.
View previous data file directories

[Oracle @ localhost oracle_cold] $ moredatafile. log

SELECT name FROM v $ datafile;

1/home/oradata/orcl/system01.dbf

2/home/oradata/orcl/sysaux01.dbf

3/home/oradata/orcl/undotbs01.dbf

4/home/oradata/orcl/users01.dbf

5/home/oradata/orcl/orclk01.dbf

6/home/oradata/orcl/plas01.dbf

7/home/oradata/orcl/pl01.dbf

8/home/oradata/orcl/help01.dbf

9/home/oradata/orcl/adobelc01.dbf

10/home/oradata/orcl/sms01.dbf

11/home/oradata/orcl/plcrm01.dbf

[Oracle @ localhost oracle_cold] $

Start overwriting previous data file directories

[Oracle @ localhost oracle_cold] $ cp orcl_2/*. dbf/home/oradata/orcl/

[Oracle @ localhost oracle_cold] $

2.5 start the database
SQL> startup

ORACLE instance started.

Total System Global Area 5344731136 bytes

Fixed Size 2213136 bytes

Variable Size 3355446000 bytes

Database Buffers 1946157056 bytes

Redo Buffers 40914944 bytes

Database mounted.

Database opened.

SQL>

2.6 enable archive log transmission on the master database
SQL> ALTER system SET log_archive_dest_state_2 = 'enable ';

 

System altered.

SQL>

2.7 then the slave database starts the application
Select sequence #, applied fromv $ archived_log order by sequence # asc;

SQL> alter database recovermanagedstandby database disconnect from session;

 

Database altered.

SQL>

SQL> select open_modefromv $ database;

OPEN_MODE

--------------------

READ ONLY WITH APPLY

SQL>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.