"Copy database 10g--clone-1 using Rman"

Source: Internet
Author: User
Tags reserved sqlplus

Target database: jadl0g

Replicated Results Database: d10g

Note: The target library is on the same machine as the Clone results Library * * * *

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 Monitoring

Lsnrctl stop
Lsnrctl start
Tnsping d10g
Tnsping jadl10g

4. Create a password file and a parameter file

[Email protected] ~]$ cd/u01/oracle/10g/dbs/
[Email protected] dbs]$ orapwd file=orapwd10g password=oracle
[Email protected] dbs]$ strings Spfilejadl10g.ora > Initd10g.ora
[Email protected] dbs]$ VI initd10g.ora
: 1,$ s/jadl10g/d10g/g---Execute the command

[Email protected] 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 the appropriate file
[Email protected] dbs]$ mkdir/u01/oracle/admin/d10g/adump-p
[Email protected] dbs]$ mkdir/u01/oracle/admin/d10g/bdump-p
[Email protected] dbs]$ mkdir/u01/oracle/admin/d10g/cdump-p
[Ora[email protected] dbs]$ mkdir/u01/oracle/admin/d10g/udump-p
[Email protected] dbs]$ mkdir/u01/oracle/oradata/d10g
[Email protected] dbs]$Export oracle_sid=d10g
[Email protected] dbs]$Rman Target/
Recovery manager:release 10.2.0.5.0-production on Fri Nov 7 12:59:20 2014
Copyright (c) 1982, 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.
[Email protected] dbs]$Sqlplus/as sysdba
Sql*plus:release 10.2.0.5.0-production on Fri Nov 7 13:00:15 2014
Copyright (c) 1982, Oracle. All rights Reserved.
Connected to:
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

****************************
[[email protected] dbs]$ Rman target Sys/[email protected] auxiliary sys/[email protected]
Recovery manager:release 10.2.0.5.0-production on Fri Nov 7 13:26:11 2014
Copyright (c) 1982, 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 my target database without a password file.
The workaround is to create a password file
[Email protected] dbs]$ orapwd file=orapwjadl10g password=oracle
****************************
[Email protected] dbs]$Rman target Sys/[email protected] auxiliary sys/[email protected]
Recovery manager:release 10.2.0.5.0-production on Fri Nov 7 13:34:12 2014
Copyright (c) 1982, Oracle. All rights reserved.
Connected to target database:jadl10g (dbid=2011530396)
Connected to auxiliary database:d10g (not mounted)
Execute the following command (note that the order must be remote and local):
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 10m,
4> '/u01/oracle/oradata/d10g/redo02.log ' size 10m;

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 to
"/U01/ORACLE/ORADATA/D10G/SYSTEM01.DBF";
Set newname for DataFile 2 to
"/U01/ORACLE/ORADATA/D10G/UNDOTBS01.DBF";
Set newname for DataFile 3 to
"/U01/ORACLE/ORADATA/D10G/SYSAUX01.DBF";
Set newname for DataFile 4 to
"/U01/ORACLE/ORADATA/D10G/USERS01.DBF";
Set newname for DataFile 5 to
"/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 does not do; 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 ten M,
GROUP 2 '/u01/oracle/oradata/d10g/redo02.log ' SIZE ten 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/o 1_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/o 1_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/o 1_mf_1_1_b5rqvjwq_.arc
Archive log thread 1 sequence 2 is already on disk as file/u01/oracle/flash_recovery_area/jadl10g/archivelog/2014_11_07/o 1_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 ten M,
GROUP 2 '/u01/oracle/oradata/d10g/redo02.log ' SIZE ten M
DataFile
'/U01/ORACLE/ORADATA/D10G/SYSTEM01.DBF '
CHARACTER SET Al32utf8

Contents of Memory Script:
{
Set newname for Tempfile 1 to
"/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 that clone is successful:
[Email protected] dbs]$ Sqlplus/as SYSDBA
Sql*plus:release 10.2.0.5.0-production on Fri Nov 7 14:21:20 2014
Copyright (c) 1982, Oracle. All rights Reserved.
Connected to:
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 issues
2. Network problems
3. Parameter issues
4.rman Statement Db_file_name_convert There is a problem with the same server Setup syntax
5. Note the need to have a backup, remote, copy backup to the target library

"Copy database 10g--clone-1 using Rman"

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.