Oracle 11gR2 uses RMAN to copy full-database records
Oracle 11gR2 uses RMAN to copy full-database records
TNS and listener are configured on the source and target ends (11g dynamic listening sys cannot log on in nomount status, and static listening needs to be configured)
[Oracle @ 154-Oracle_Archive admin] $ vi tnsnames. ora
TESTHIS.154 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.234.154) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = TESTHIS)
)
)
TESTHIS.11 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.234.11) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = testhisnew)
)
)
[Oracle @ 154-Oracle_Archive admin] $ vi listener. ora
# Listener. ora Network Configuration File:/opt/app/oracle/product/11.2.0/dbhome_1/network/admin/listener. ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 154-Oracle_Archive.hubs1.pu) (PORT = 1521 ))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = testhis
(ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = testhis)
)
)
Create pfile in the source database
SQL> create pfile = '/home/oracle/pfile. ora' from spfile;
File created.
Transmit the pfile, listener, tnsname, and orapw files of the source database to the specified location of the target database and modify them.
[Oracle @ 154-Oracle_Archive admin] $ scp *. ora root@192.168.234.11:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin
Root@192.168.234.11's password:
Listener. ora 100% 619 0.6KB/s
Tnsnames. ora 100% 448 0.4KB/s
[Oracle @ 154-Oracle_Archive ~] $ Scp pfile. ora root@192.168.234.11:/home/oracle
Root@192.168.234.11's password:
Pfile. ora 100% 1018 1.0KB/s
[Oracle @ 154-Oracle_Archive dbs] $ scp orapwtesthis root@192.168.234.11:/home/oracle
Root@192.168.234.11's password:
Permission denied, please try again.
Root@192.168.234.11's password:
Orapwtesthis 100% 1536 1.5KB/s
[Oracle @ Oracle_archive ~] $ Cp orapwtesthis/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwtesthisnew
Modify pfile
[Oracle @ Oracle_archive ~] $ Vi pfile. ora
Test hisnew. _ db_cache_size = 922746880
Testhisnew. _ Java _pool_size = 33554432
Test hisnew. _ large_pool_size = 16777216
Testhisnew. _ oracle_base = '/u01/app/oracle' # ORACLE_BASE set from environment
Test hisnew. _ pga_aggregate_target = 1358954496
Testhisnew. _ sga_target = 2533359616
Testhisnew. _ shared_io_pool_size = 0
Test hisnew. _ shared_pool_size = 1493172224
Test hisnew. _ streams_pool_size = 33554432
*. Audit_file_dest = '/u01/app/oracle/admin/testhisnew/adump'
*. Audit_trail = 'db'
*. Compatible = '11. 2.0.0.0'
*. Control_files = '/u01/app/oracle/oradata/testhisnew/control01.ctl', '/u01/app/oracle/fast_recovery_area/testhisnew/control02.ctl'
*. Db_block_size = 8192
*. Db_domain =''
*. Db_name = 'testhisne' // The maximum length is 8 characters.
*. Db_recovery_file_dest = '/u01/app/oracle/fast_recovery_area'
*. Db_recovery_file_dest_size = 10737418240
*. Diagnostic_dest = '/u01/app/oracle'
*. Dispatchers = '(PROTOCOL = TCP) (SERVICE = testhisnewXDB )'
*. Log_archive_dest_1 = 'location =/u01/app/oracle/test_arch'
*. Memory_target = 3879731200
*. Open_cursors = 300
*. Processses = 1000
*. Remote_login_passwordfile = 'clusive'
*. Sessions = 1105
*. Undo_tablespace = 'undotbs1'
Db_file_name_convert = ('/u01/app/oracle/oradata/testhis/', '/u01/app/oracle/oradata/testhisnew /')
Log_file_name_convert = ('/u01/app/oracle/oradata/testhis/', '/u01/app/oracle/oradata/testhisnew /')
Create related directories
[Oracle @ Oracle_archive ~] $ Mkdir-p/u01/app/oracle/admin/testhis_n/adump
[Oracle @ Oracle_archive ~] $ Mkdir-p/u01/app/oracle/oradata/testhis_n/
[Oracle @ Oracle_archive ~] $ Mkdir-p/u01/app/oracle/fast_recovery_area/testhis_n/
Log on to the database to create a spfile and start the instance.
[Oracle @ Oracle_archive ~] $ Echo $ ORACLE_SID
Testhisnew
[Oracle @ Oracle_archive ~] $ Sqlplus/as sysdba
SQL * Plus: Release 11.2.0.2.0 Production on Tue Jul 28 16:14:04 2015
Copyright (c) 1982,201 0, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile = '/home/oracle/pfile. ora ';
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 3874926592 bytes
Fixed Size 2232368 bytes
Variable Size 2936016848 bytes
Database Buffers 922746880 bytes
Redo Buffers 13930496 bytes
Log on to the two databases at the source end and copy them.
[Oracle @ 154-Oracle_Archive admin] $ rman target sys/****** @ testhis.154 auxiliary sys/****** @ testhis.11
Recovery Manager: Release 11.2.0.2.0-Production on Tue Jul 28 17:46:30 2015
Copyright (c) 1982,200 9, Oracle and/or its affiliates. All rights reserved.
Connected to target database: TESTHIS (DBID = 1362777844)
Connected to auxiliary database: TESTHISNE (not mounted)
RMAN> duplicate target database to testhisne from active database nofilenamecheck;
.
.
.
Datafile 32 switched to datafile copy
Input datafile copy RECID = 31 STAMP = 886273519 file name =/u01/app/oracle/oradata/testhisnew/test27.dbf
Datafile 33 switched to datafile copy
Input datafile copy RECID = 32 STAMP = 886273519 file name =/u01/app/oracle/oradata/testhisnew/testdeltable01.dbf
Contents of Memory Script:
{
Alter clone database open resetlogs;
}
Executing Memory Script
Database opened
Finished Duplicate Db at 28-JUL-15
.
After the replication is complete, start and close the target database, verify whether the replication is successful, and check whether the alter log has an error log. After confirming the error, back up the database in time.
-------------------------------------- Recommended reading --------------------------------------
ORA-19571 for RMAN backup
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 --------------------------------------