The Codex of Business Writing Software for Real-World Solutions 2.pptx
Refresh development from productions
1. REFRESH DEVELOPMENT FROM PRODUCTION OSAMA MUSTAFA
REFRESH DEVELOPMENT FROM PRODUCTION
Introduction
This document describe steps to refresh database development from production, this way can work on
RAC environment as well.
Environment:-
Production: -
Oracle Database 11.2.0.3
Operating system: Oracle Linux 6.4
Development:-
Oracle Database 11.2.0.3
Operating system: Oracle Linux 6.4
Software needed:-
1- Winscp / or Any FTP Client.
2- ssh Client.
2. REFRESH DEVELOPMENT FROM PRODUCTION OSAMA MUSTAFA
REFRESH DEVELOPMENT FROM PRODUCTION
About the Author
Osama Mustafa has progressive experience in Oracle Products, community. He recently served as
Oracle Database Administrator.
Provide Database Implementation Solutions, High Availability Solution, Infrastructure and Storage
Planning, Install, Configure, Implement and manage Oracle E-Business Suite environments. Architect,
build and support highly-available Oracle EBS, Database and Fusion Middleware environments including
appropriate reporting, Installs, configures, upgrades, tunes, and maintains production, development and
test databases.
He entered Oracle ACE Program in 2013, he is author for the book Oracle Penetration Testing, Osama
Mustafa Certified OCP 10g,11g, Linux Implementations , Certified Ethical hacker and LPT , and Solaris
Administrator.
Include to all this Osama Mustafa is international Speaker in Oracle User Group and Oracle OTN Tour,
Published Online Articles in His blog about Oracle Technology, Volunteer in Oracle User Group such as
IOUG, ODTUG and UKOUG , Volunteer Board member in RACSIG and Organizer for RACATTACK
Event around the world. Recently his article has been published on OTECH magazine about Real
Application Cluster Here.
Twitter: @OsamaOracle
G+: Osama Mustafa
SlidShare: Osama Mustafa
LinkedIn: http://www.linkedin.com/in/osamamustafa
Blog: https://osamamustafa.blogpsot.com.
3. REFRESH DEVELOPMENT FROM PRODUCTION OSAMA MUSTAFA
REFRESH DEVELOPMENT FROM PRODUCTION
Step #1:- Take Controlfile From Production Side.
sqlplus "/as sysdba"
SQL> alter database backup controlfile to trace as “Location”;
Database altered.
SQL> exit
Step #2: Go to Location Controlfile Trace.
Open this trace file and copy all its contents to notepad++ on your desktop machine.
Step #3: Now Take Backup for your Database.
sqlplus "/as sysdba"
SQL> alter system archive log current;
SQL> alter database begin backup;
Check the Active Backup:-
SQL> select count(*) from v$backup where status='ACTIVE';
SQL> exit;
Step #4: Now Create backup folder called “BKP_FOLDER” and Copy All the Data files And Redo
Logs to this Directory, once copy is done Run the following command :-
sqlplus "/as sysdba"
SQL> alter system archive log current;
SQL> alter database end backup;
SQL> select count(*) from v$backup where status='ACTIVE';
SQL> alter system archive log current;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> exit;
Create another “ARCH_FOLDER” and Copy All Archives log that generated in the same day to
this folder if your database run No Archive mode skip this step.
All the above Should Be Run on Production.
4. REFRESH DEVELOPMENT FROM PRODUCTION OSAMA MUSTAFA
REFRESH DEVELOPMENT FROM PRODUCTION
Step #5: On Test Environment, Shutdown the database & Listener.
Note: Rename the directory that containing all data files, Redo logs and control files and
create new directory with the same name.
Step #6: Copy Backup (from production) to Test Server (New Folder).
Copy all the data files, Redo logs from “BKP_Folder” on production to Directory on
Test Server “Don’t Copy Control file”
Now Copy all The Archives Logs from Production “Arch_Folder” to same directory
on test.
Step #7: Create control file that already Saved On Notepad.
Edit Controlfile using Notepad.
Remove all the lines before the line “STARTUP NOMOUNT”.
Change the datafiles path from production to test depend on the location.
Remove all the lines before Restlogs option.
Change the following line :-
CREATE CONTROLFILE REUSE DATABASE "Production" RESETLOGS
ARCHIVELOG
TO
CREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS
NOARCHIVELOG
If you take the controlfile From RAC remove all the lines contains Logfile Thread 2.
Now your Controlfile is ready and check the permission of Datafiles please.
Save the file under “New_CTL.sql”.
Step #8: Before Run the Script Make sure that Parameter files log_archive_format Same
as Production. If you don’t use Archive mode forget it.
sqlplus "/as sysdba"
Connected to idle instance
SQL> @New_CTL.sql
Control File created
5. REFRESH DEVELOPMENT FROM PRODUCTION OSAMA MUSTAFA
REFRESH DEVELOPMENT FROM PRODUCTION
SQL> recover database using backup controlfile until cancel;
In this step it will ask you about Archive log Do you remember why we copied archive
from production to Test indicate the location, if it’s keep asking them apply the
archive log one by one till you receive “Media recovery cancelled.” or “Media recovery
complete.”, it means recovery is successful.
Step #9: Shutdown database and Run the following:-
SQL> shutdown immediate;
SQL> alter database open resetlogs;
If the above command not working set the following parameter to True
_no_recovery_through_resetlogs=TRUE
Step #10: Disable Thread 2 on Database (if you are using RAC).
SQL > ALTER DATABASE DISABLE THREAD 2;
Then
SQL > ALTER DATABASE DROP LOGFILE …..
Step #11: Finally Shutdown and Startup Database.