[Use rman to copy the Database 10 Gb -- clone-1], rman10g -- clone-1

Source: Internet
Author: User

[Use rman to copy the Database 10 Gb -- clone-1], rman10g -- clone-1

Target Database: jadl0g

Replicated result Database: d10g

Note: *** the target database and clone result database are on the same host ****

1. vi/u01/oracle/10g/network/admin/tnsnames. ora

D10G =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = oracle.db.com) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = d10g)
)
(Failover = on)
)

2. vi/u01/oracle/10g/network/admin/listener. ora

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = jadl10g)
(SID_NAME = jadl10g)
(ORACLE_HOME =/u01/oracle/10g)
)
(SID_DESC =
(GLOBAL_DBNAME = d10g)
(SID_NAME = d10g)
(ORACLE_HOME =/u01/oracle/10g)
)
)

3. Restart the listener

Lsnrctl stop
Lsnrctl start
Tnsping d10g
Tnsping jadl10g

4. Create a password file and a parameter file

[Oracle @ oracle ~] $ Cd/u01/oracle/10g/dbs/
[Oracle @ oracle dbs] $ orapwd file = orapwd10g password = oracle
[Oracle @ oracle dbs] $ strings spfilejadl10g. ora> initd10g. ora
[Oracle @ oracle dbs] $ vi initd10g. ora
: 1, $ s/jadl10g/d10g/g --- execute this command

[Oracle @ oracle dbs] $ grep u01 initd10g. ora
*. Audit_file_dest = '/u01/oracle/admin/d10g/adump'
*. Background_dump_dest = '/u01/oracle/admin/d10g/bdump'
*. Control_files = '/u01/oracle/oradata/d10g/control01.ctl', '/u01/oracle/flash_recovery_area/d10g/control02.ctl' # Restore Controlfile
*. Core_dump_dest = '/u01/oracle/admin/d10g/cdump'
*. Db_recovery_file_dest = '/u01/oracle/flash_recovery_area'
*. User_dump_dest = '/u01/oracle/admin/d10g/udump'

5. Create a file
[Oracle @ oracle dbs] $ mkdir/u01/oracle/admin/d10g/adump-p
[Oracle @ oracle dbs] $ mkdir/u01/oracle/admin/d10g/bdump-p
[Oracle @ oracle dbs] $ mkdir/u01/oracle/admin/d10g/cdump-p
[Oracle @ oracle dbs] $ mkdir/u01/oracle/admin/d10g/udump-p
[Oracle @ oracle dbs] $ mkdir/u01/oracle/oradata/d10g
[Oracle @ oracle dbs] $ export ORACLE_SID = d10g
[Oracle @ oracle dbs] $ rman target/
Recovery Manager: Release 10.2.0.5.0-Production on Fri Nov 7 12:59:20 2014
Copyright (c) 1982,200 7, Oracle. All rights reserved.
Connected to target database (not started)
RMAN> startup nomount
Oracle instance started
Total System Global Area 599785472 bytes
Fixed Size 2098112 bytes
Variable Size 171969600 bytes
Database Buffers 419430400 bytes
Redo Buffers 6287360 bytes
RMAN> exit
Recovery Manager complete.
[Oracle @ oracle dbs] $ sqlplus/as sysdba
SQL * Plus: Release 10.2.0.5.0-Production on Fri Nov 7 13:00:15 2014
Copyright (c) 1982,201 0, Oracle. All Rights Reserved.
Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0-64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
And Real Application Testing options

SQL> create spfile from pfile;
File created.

SQL> shutdown
ORA-01507: database not mounted
ORACLE instance shut down.


SQL> startup nomount
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2098112 bytes
Variable Size 171969600 bytes
Database Buffers 419430400 bytes
Redo Buffers 6287360 bytes
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0-64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
And Real Application Testing options

****************************
[Oracle @ oracle dbs] $ rman target sys/oracle @ jadl10g auxiliary sys/oracle @ d10g
Recovery Manager: Release 10.2.0.5.0-Production on Fri Nov 7 13:26:11 2014
Copyright (c) 1982,200 7, Oracle. All rights reserved.


RMAN-00571: ========================================================== ==============================
RMAN-00569: ==================== error message stack follows ==========================
RMAN-00571: ========================================================== ==============================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-01031: insufficient privileges
This error is caused by the absence of a password file in my target database.
The solution is to create a password file.
[Oracle @ oracle dbs] $ orapwd file = orapwjadl10g password = oracle
****************************
[Oracle @ oracle dbs] $ rman target sys/oracle @ jadl10g auxiliary sys/oracle @ d10g
Recovery Manager: Release 10.2.0.5.0-Production on Fri Nov 7 13:34:12 2014
Copyright (c) 1982,200 7, Oracle. All rights reserved.
Connected to target database: JADL10G (DBID = 2011530396)
Connected to auxiliary database: D10G (not mounted)
Execute the following command (note that it must be in the remote and local order ):
RMAN> duplicate target database to "D10G" nofilenamecheck
2> db_file_name_convert ('/u01/oracle/oradata/jadl10g/', '/u01/oracle/oradata/d10g /')
3> logfile '/u01/oracle/oradata/d10g/redo01.log' size 10 m,
4> '/u01/oracle/oradata/d10g/redo02.log' size 10 m;

Starting Duplicate Db at 07-NOV-14
Using target database control file instead of recovery catalog
Allocated channel: ORA_AUX_DISK_1
Channel ORA_AUX_DISK_1: sid = 156 devtype = DISK

Contents of Memory Script:
{
Set until scn 556591;
Set newname for datafile 1
"/U01/oracle/oradata/d10g/system01.dbf ";
Set newname for datafile 2
"/U01/oracle/oradata/d10g/undotbs01.dbf ";
Set newname for datafile 3
"/U01/oracle/oradata/d10g/sysaux01.dbf ";
Set newname for datafile 4
"/U01/oracle/oradata/d10g/users01.dbf ";
Set newname for datafile 5
"/U01/oracle/oradata/d10g/example01.dbf ";
Restore
Check readonly
Clone database
;
}
Executing Memory Script
Executing command: SET until clause
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME

Starting restore at 07-NOV-14
Using channel ORA_AUX_DISK_1

Skipping datafile 1; already restored to file/u01/oracle/oradata/d10g/system01.dbf
Skipping datafile 2; already restored to file/u01/oracle/oradata/d10g/undotbs01.dbf
Skipping datafile 3; already restored to file/u01/oracle/oradata/d10g/sysaux01.dbf
Skipping datafile 4; already restored to file/u01/oracle/oradata/d10g/users01.dbf
Skipping datafile 5; already restored to file/u01/oracle/oradata/d10g/example01.dbf
Restore not done; all files readonly, offline, or already restored
Finished restore at 07-NOV-14
SQL statement: CREATE CONTROLFILE REUSE SET DATABASE "D10G" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 292
LOGFILE
GROUP 1'/u01/oracle/oradata/d10g/redo01.log' SIZE 10 M,
GROUP 2'/u01/oracle/oradata/d10g/redo02.log 'SIZE 10 M
DATAFILE
'/U01/oracle/oradata/d10g/system01.dbf'
Character set AL32UTF8

Contents of Memory Script:
{
Switch clone datafile all;
}
Executing Memory Script

Datafile 2 switched to datafile copy
Input datafile copy recid = 1 stamp = 863013896 filename =/u01/oracle/oradata/d10g/undotbs01.dbf
Datafile 3 switched to datafile copy
Input datafile copy recid = 2 stamp = 863013896 filename =/u01/oracle/oradata/d10g/sysaux01.dbf
Datafile 4 switched to datafile copy
Input datafile copy recid = 3 stamp = 863013896 filename =/u01/oracle/oradata/d10g/users01.dbf
Datafile 5 switched to datafile copy
Input datafile copy recid = 4 stamp = 863013896 filename =/u01/oracle/oradata/d10g/example01.dbf

Contents of Memory Script:
{
Set until scn 556591;
Recover
Clone database
Delete archivelog
;
}
Executing Memory Script

Executing command: SET until clause

Starting recover at 07-NOV-14
Using channel ORA_AUX_DISK_1

Starting media recovery

Archive log thread 1 sequence 1 is already on disk as file/u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_1_b5qkpgh1 _. arc
Archive log thread 1 sequence 2 is already on disk as file/u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_2_b5qkpk0o _. arc
Archive log thread 1 sequence 1 is already on disk as file/u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_1_b5rqv1_q _. arc
Archive log thread 1 sequence 2 is already on disk as file/u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_2_b5rqvmxf _. arc
Archive log filename =/u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_1_b5qkpgh1 _. arc thread = 1 sequence = 1
Archive log filename =/u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_2_b5qkpk0o _. arc thread = 1 sequence = 2
Media recovery complete, elapsed time: 00:00:23
Finished recover at 07-NOV-14

Contents of Memory Script:
{
Shutdown clone;
Startup clone nomount;
}
Executing Memory Script

Database dismounted
Oracle instance shut down

Connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 599785472 bytes

Fixed Size 2098112 bytes
Variable Size 171969600 bytes
Database Buffers 419430400 bytes
Redo Buffers 6287360 bytes
SQL statement: CREATE CONTROLFILE REUSE SET DATABASE "D10G" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 292
LOGFILE
GROUP 1'/u01/oracle/oradata/d10g/redo01.log' SIZE 10 M,
GROUP 2'/u01/oracle/oradata/d10g/redo02.log 'SIZE 10 M
DATAFILE
'/U01/oracle/oradata/d10g/system01.dbf'
Character set AL32UTF8

Contents of Memory Script:
{
Set newname for tempfile 1
"/U01/oracle/oradata/d10g/temp01.dbf ";
Switch clone tempfile all;
Catalog clone datafilecopy "/u01/oracle/oradata/d10g/undotbs01.dbf ";
Catalog clone datafilecopy "/u01/oracle/oradata/d10g/sysaux01.dbf ";
Catalog clone datafilecopy "/u01/oracle/oradata/d10g/users01.dbf ";
Catalog clone datafilecopy "/u01/oracle/oradata/d10g/example01.dbf ";
Switch clone datafile all;
}
Executing Memory Script

Executing command: SET NEWNAME

Renamed temporary file 1 to/u01/oracle/oradata/d10g/temp01.dbf in control file

Cataloged datafile copy
Datafile copy filename =/u01/oracle/oradata/d10g/undotbs01.dbf recid = 1 stamp = 863013929

Cataloged datafile copy
Datafile copy filename =/u01/oracle/oradata/d10g/sysaux01.dbf recid = 2 stamp = 863013929

Cataloged datafile copy
Datafile copy filename =/u01/oracle/oradata/d10g/users01.dbf recid = 3 stamp = 863013929

Cataloged datafile copy
Datafile copy filename =/u01/oracle/oradata/d10g/example01.dbf recid = 4 stamp = 863013929

Datafile 2 switched to datafile copy
Input datafile copy recid = 1 stamp = 863013929 filename =/u01/oracle/oradata/d10g/undotbs01.dbf
Datafile 3 switched to datafile copy
Input datafile copy recid = 2 stamp = 863013929 filename =/u01/oracle/oradata/d10g/sysaux01.dbf
Datafile 4 switched to datafile copy
Input datafile copy recid = 3 stamp = 863013929 filename =/u01/oracle/oradata/d10g/users01.dbf
Datafile 5 switched to datafile copy
Input datafile copy recid = 4 stamp = 863013929 filename =/u01/oracle/oradata/d10g/example01.dbf

Contents of Memory Script:
{
Alter clone database open resetlogs;
}
Executing Memory Script
Database opened
Finished Duplicate Db at 07-NOV-14
RMAN> exit
Recovery Manager complete.
Verify whether the clone is successful:
[Oracle @ oracle dbs] $ sqlplus/as sysdba
SQL * Plus: Release 10.2.0.5.0-Production on Fri Nov 7 14:21:20 2014
Copyright (c) 1982,201 0, Oracle. All Rights Reserved.
Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0-64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
And Real Application Testing options

SQL> select instance_name from v $ instance;
INSTANCE_NAME
----------------
D10g


1. Password File Problems
2. Network Problems
3. Parameter Problems
4. the syntax of the rman statement db_file_name_convert is incorrect on the same server.
5. Make sure that a backup is required. If the backup is remote, copy the backup to the target database.

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.