Clone a database through RMAN on a different machine

Source: Internet
Author: User

Clone a database through RMAN on a different machine

When RMAN is used for replication, RMAN will connect to the target database and the secondary instance. If catalog backup is used, it will also connect to the recovery directory. When RMAN connects to the target database, it can access the backup details recorded in its control file. Only by connecting to the secondary instance can one or more channel processes be allocated to the secondary instance, when 9i starts, a channel is automatically created. To connect to a secondary instance, you need to start the secondary instance first. A pfile parameter file is obtained from the target database creata pfile from spfile because there is no control file, therefore, you can only start the nomount phase. RMAN will generate the sysdba connection to this auxiliary instance.

After connecting the target database and the secondary instance, you can use the duplicate command to copy the database. The replication process is generally divided into the following phases: 1. rman determines the backup status and location 2, rman allocates a secondary channel on the secondary instance. 3. restores data files on the secondary instance. 4. Creates a new control file. 5. rman restores archived logs and recovers. 6, rman resets the DBID of the auxiliary database (uniquely identifies a database) and opens the database with open resetlogs.

-------------------------------------- Recommended reading --------------------------------------

RMAN: Configure an archive log deletion policy

Basic Oracle tutorial-copying a database through RMAN

Reference for RMAN backup policy formulation

RMAN backup learning notes

Oracle Database Backup encryption RMAN Encryption

-------------------------------------- Split line --------------------------------------

Platform preparation:
Oracle Linux + Oracle 11G
Target database:
ORACLE_HOME =/uoracle/app
ORACLE_BASE =/orabase
ORACLE_SID = orcl
IP: 192.168.0.45
Auxiliary database:
ORACLE_HOME =/uoracle/app
ORACLE_BASE =/orabase
ORACLE_SID = orcl
IP: 192.168.0.46

Procedure ):
1: The server running the secondary instance must first install the corresponding oracle client, and the ORACLE_BASE and ORACLE_HOME directories are the same as the target database;
2: Build the directory structure of the secondary database;
3: Create a parameter file, copy it, and modify it accordingly;
4: Create a password file for the secondary instance, orapwd
5: configure the listener and tnsname File
6: Back up the target database and copy it to the secondary instance service, or mount it with NFS;
7. Use pfile to start the auxiliary instance to nomount and exit the session;
8: duplicate command to copy the database;
9: Create a spfile
Specific implementation:
1: Install the client
2: Build the directory structure of the secondary database (build the directory structure of the secondary database based on the directories involved in the parameter file)
[Oracle @ orl4 ~] $ Echo $ ORACLE_BASE
/Orabase
[Oracle @ orl4 ~] $ Cd/orabase
[Oracle @ orgroovy orabase] $ mkdir./oradata/orcl-p
[Oracle @ orgroovy orabase] $ mkdir./fast_recovery_area/orcl-p # recreate the control file and store the control file
[Oracle @ orgroovy orabase] $ pwd
/Orabase
[Oracle @ orgroovy orabase] $ mkdir./admin/orcl-p
[Oracle @ orgroovy orabase] $ cd./admin/orcl/
[Oracle @ orgroovy orcl] $ mkdir {a, B, c, d, u} dump
[Oracle @ orgroovy orcl] $ mkdir pfile

3: Create a parameter file, copy it, and modify it accordingly.
3.1: Create a pfile on the target database and copy it to the secondary database? /Dbs directory (it must be in the $ ORACLE_HOME/dbs directory; otherwise, it cannot be recognized)
SQL> create pfile = '/tmp/initorcl. ora' from spfile;
SQL> scp/tmp/initorcl. ora 192.168.0.46:/oracle/home/dbs
3.2: Modify the parameter file accordingly
The directory structure and Instance name are the same, so no modification is made.
3.3: Use pfile to start the database to the nomount state, perform the test, and create a spfile

SQL> startup pfile = '/uoracle/app/dbs/initorcl. ora'> ORACLE instance started.
Total System Global Area 1.0055E + 10 bytes
Fixed Size 2237008 bytes
Variable Size 3154120112 bytes
Database Buffers 6878658560 bytes
Redo Buffers 19767296 bytes
Database mounted.
Database opened.
SQL> create spfile from pfile;
File created.

4: Create a password file for the secondary instance. The password is consistent with the source database.
[Oracle @ orgroovy bin] $ pwd
/Uoracle/app/bin
[Oracle @ orlinoleic bin] $ orapwd file = $ ORACLE_HOME/dbs/orapworcl password = admin123;
[Oracle @ orgroovy bin] $
[Oracle @ orlinoleic bin] $ ls/uoracle/app/dbs/orapworcl
/Uoracle/app/dbs/orapworcl


5: configure the listener and tnsname File
On the source database:
[Root @ bzdb ~] # Cat/uoracle/app/network/admin/listener. ora
# Listener. ora Network Configuration File:/uoracle/app/network/admin/listener. ora
# Generated by Oracle configuration tools.


Orcl =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.45) (PORT = 1521 ))
)
)


ADR_BASE_LISTENER =/orabase


[Root @ bzdb ~] # Cat/uoracle/app/network/admin/tnsnames. ora
# Tnsnames. ora Network Configuration File:/uoracle/app/network/admin/tnsnames. ora
# Generated by Oracle configuration tools.


ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.45) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)


AUXORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.46) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

For more details, please continue to read the highlights on the next page:

 

  • 1
  • 2
  • Next Page

Related Article

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.