Posts

Showing posts from February, 2016

Data pump to refresh schema in the same database

Below steps can be followed to import data from one schema to another, inside single db instance. impdp with network_link is used. Realted question on OTN --> https://community.oracle.com/message/13652057#13652057 SQL> create public database link impdpt connect to SYSTEM identified by abc123 using 'DG1'; Database link created. SQL> [oracle@prima admin]$ impdp system/abc123 directory=DATA_PUMP_DIR network_link=impdpt schemas=hr remap_schema=hr:hrtn logfile=test_same.log Import: Release 11.2.0.4.0 - Production on Tue Dec 29 02:53:24 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SYSTEM"."SYS_IMPORT_SCHEMA_01": system/******** directory=DATA_PUMP_DIR network_link=impdpt schemas=hr remap_schema=hr:hrtn logfile=...

Simple Bash Script to automate restore backup of controlfile.

Came up with this very simple script to automate the restore of control file from given backup. This was to answer a question posted on OTN, https://community.oracle.com/message/13668456#13668456 [oracle@prima ~]$ cat cnt_rst.sh export ORACLE_HOME=/orahome/product/11.2.0/dbhome_1 export ORACLE_SID=DG1 bdate=20151214 rman target / cmdfile='to_os.scr' log='os_file.txt' #bpc=`cat os_file.txt | grep -i $bdate | grep -i ncnn | cut -d '/' -f 2-` - to restore from piece bpc=`cat os_file.txt | grep -i 20151214 | grep -i tag: | awk '{print $NF}'` echo "run {" >> rst_cnt.scr #echo "restore controlfile to '/home/oracle/cnt_$bdate.cnt' from '/$bpc';" >> rst_cnt.scr - to restore from piece echo "restore controlfile to '/home/oracle/cnt_$bdate.cnt' from tag $bpc;" >> rst_cnt.scr echo "}" >> rst_cnt.scr rman target / cmdfile='rst_cnt.scr...