17. Backup a database and make a CLONE of that database add listener with different database name in different location in real time. - sayanbhattacharya1234/Oracle_DBA GitHub Wiki

Q. Backup a database and make a CLONE of that database add listener with different database name in different location in real time.

Steps

Step 1

Start two machines and build network between them . we login in a server A open a database. and startup, go RMAN take a backup with archivelog and create a listener and tnsnames and start the listener and check tns.

Step 2

Now this tns file send to server B for neew database with scp /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/tnsprod.ora [email protected]: /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/ and file is send.

Step 3

i need to create a pfile -> i get location of adump,controlfile,datafile for that goto SQL> create pfile from spfile; on server A, i need to copy the password file ( sys password should be same in the database ) before that.

Step 4

open pfile by vi (server A ) copy a adump location and goto server b and paste by mkdir -p adump location with new named database , same for control files locations.

now (from server A) scp passfile to (server B) scp /u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapwprod [email protected]:/u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapwbooks

Step 5

copy a database location by cat /etc/oratab goto server b and vi /etc/ortab then create a new database - books

set env and check tns if not then systemctl stop firewalld both server and again check > direct goto RMAN

RMAN target sys/oracle@tnsprod auxiliary sys/oracle(books)

Step 6

RMAN> run a script

run { >duplicate database to books from active database , >spfile ,> parameter_value_convert=('prod' , 'books' ), > set db_file_name_convert = '/u01/app/oracle/oradata/PROD/' , '/u01/app/oracle/oradata/BOOKS' , > set log_file_name_convert= '/u01/app/oracle/oradata/PROD/' , '/u01/app/oracle/oradata/BOOKS' , set control_files= 'u01/.../../BOOKS/cont1.ctl'.'/u01/app/.../fast_../BOOKS/cont2.ctl' , >set db_name='Books' , > NOFILENAMECHECK; }

goto $> open pfile location and create a p file , vi initbooks.ora only with dbname [ *.db_name='book' and save ]

goto sqlplus > startup nomount > rman target sys/oracle@tnsprod auxiliary sys/oracle(books) > RMAN> run {...} done and check database.

##.

1

2

3

4