SlideShare a Scribd company logo
1 of 5
Download to read offline
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.
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.
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.
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
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.

More Related Content

What's hot

Are You Ready for 12c? Data Migration and Upgrade Best Practices
Are You Ready for 12c? Data Migration and Upgrade Best PracticesAre You Ready for 12c? Data Migration and Upgrade Best Practices
Are You Ready for 12c? Data Migration and Upgrade Best Practices
Performance Tuning Corporation
 
Oracle Linux 7 Beta First Look (Installations)
Oracle Linux 7 Beta First Look (Installations)Oracle Linux 7 Beta First Look (Installations)
Oracle Linux 7 Beta First Look (Installations)
Osama Mustafa
 
Oracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11gOracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11g
uzzal basak
 

What's hot (20)

Install oracle grid infrastructure on linux 6.6
Install oracle grid infrastructure on linux 6.6Install oracle grid infrastructure on linux 6.6
Install oracle grid infrastructure on linux 6.6
 
Installing oracle timesten database On Linux
Installing oracle timesten database On Linux Installing oracle timesten database On Linux
Installing oracle timesten database On Linux
 
Are You Ready for 12c? Data Migration and Upgrade Best Practices
Are You Ready for 12c? Data Migration and Upgrade Best PracticesAre You Ready for 12c? Data Migration and Upgrade Best Practices
Are You Ready for 12c? Data Migration and Upgrade Best Practices
 
Install oracle solaris 11.2 using gui
Install oracle solaris 11.2 using guiInstall oracle solaris 11.2 using gui
Install oracle solaris 11.2 using gui
 
Oracle api gateway installation as cluster and single node
Oracle api gateway installation as cluster and single nodeOracle api gateway installation as cluster and single node
Oracle api gateway installation as cluster and single node
 
Eouc 12 on 12c osama mustafa
Eouc 12 on 12c osama mustafaEouc 12 on 12c osama mustafa
Eouc 12 on 12c osama mustafa
 
Oracle autovue
Oracle autovueOracle autovue
Oracle autovue
 
Install oracle siebel on windows 2008 r2
Install oracle siebel on windows 2008 r2Install oracle siebel on windows 2008 r2
Install oracle siebel on windows 2008 r2
 
Pluggable database 3
Pluggable database 3Pluggable database 3
Pluggable database 3
 
J2ee user managment using dwh builder
J2ee user managment using dwh builderJ2ee user managment using dwh builder
J2ee user managment using dwh builder
 
Oracle Enterprise manager 13c Installation
Oracle Enterprise manager 13c InstallationOracle Enterprise manager 13c Installation
Oracle Enterprise manager 13c Installation
 
12c installation
12c installation12c installation
12c installation
 
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
 
Oracle Linux 7 Beta First Look (Installations)
Oracle Linux 7 Beta First Look (Installations)Oracle Linux 7 Beta First Look (Installations)
Oracle Linux 7 Beta First Look (Installations)
 
Pluggable database tutorial 2
Pluggable database tutorial 2Pluggable database tutorial 2
Pluggable database tutorial 2
 
Step by Step Restore rman to different host
Step by Step Restore rman to different hostStep by Step Restore rman to different host
Step by Step Restore rman to different host
 
Oracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11gOracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11g
 
Install and upgrade Oracle grid infrastructure 12.1.0.2
Install and upgrade Oracle grid infrastructure 12.1.0.2Install and upgrade Oracle grid infrastructure 12.1.0.2
Install and upgrade Oracle grid infrastructure 12.1.0.2
 
61 Rac
61 Rac61 Rac
61 Rac
 
141 Rac
141 Rac141 Rac
141 Rac
 

Viewers also liked (9)

Deploy agent in em12c
Deploy agent in em12cDeploy agent in em12c
Deploy agent in em12c
 
Add target manually em12c
Add target manually em12cAdd target manually em12c
Add target manually em12c
 
Oracle smart flash cache
Oracle smart flash cacheOracle smart flash cache
Oracle smart flash cache
 
Exadata Smart Scan - What is so smart about it?
Exadata Smart Scan  - What is so smart about it?Exadata Smart Scan  - What is so smart about it?
Exadata Smart Scan - What is so smart about it?
 
AWR & ASH Analysis
AWR & ASH AnalysisAWR & ASH Analysis
AWR & ASH Analysis
 
Migrating to Oracle Database 12c: 300 DBs in 300 days.
Migrating to Oracle Database 12c: 300 DBs in 300 days.Migrating to Oracle Database 12c: 300 DBs in 300 days.
Migrating to Oracle Database 12c: 300 DBs in 300 days.
 
Enable Mobile Apps Designer in OBIEE
Enable Mobile Apps Designer in OBIEEEnable Mobile Apps Designer in OBIEE
Enable Mobile Apps Designer in OBIEE
 
Erp installation r12.2
Erp installation r12.2Erp installation r12.2
Erp installation r12.2
 
How to add storage to esxi 5.5
How to add storage to esxi 5.5How to add storage to esxi 5.5
How to add storage to esxi 5.5
 

Similar to Refresh development from productions

oracle upgradation
oracle upgradationoracle upgradation
oracle upgradation
influxbob
 
Oracle olap-installation
Oracle olap-installationOracle olap-installation
Oracle olap-installation
Amit Sharma
 
2011 384 hackworth_ppt
2011 384 hackworth_ppt2011 384 hackworth_ppt
2011 384 hackworth_ppt
maclean liu
 
D17316 gc20 l05_phys_sql
D17316 gc20 l05_phys_sqlD17316 gc20 l05_phys_sql
D17316 gc20 l05_phys_sql
Moeen_uddin
 
Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2
nesmaddy
 
Less04 instance
Less04 instanceLess04 instance
Less04 instance
Imran Ali
 

Similar to Refresh development from productions (20)

oracle upgradation
oracle upgradationoracle upgradation
oracle upgradation
 
[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery
 
Les 07 rman_rec
Les 07 rman_recLes 07 rman_rec
Les 07 rman_rec
 
Database upgradation
Database upgradationDatabase upgradation
Database upgradation
 
Oracle olap-installation
Oracle olap-installationOracle olap-installation
Oracle olap-installation
 
2011 384 hackworth_ppt
2011 384 hackworth_ppt2011 384 hackworth_ppt
2011 384 hackworth_ppt
 
Take your database source code and data under control
Take your database source code and data under controlTake your database source code and data under control
Take your database source code and data under control
 
E business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsE business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administrators
 
E business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsE business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administrators
 
D17316 gc20 l05_phys_sql
D17316 gc20 l05_phys_sqlD17316 gc20 l05_phys_sql
D17316 gc20 l05_phys_sql
 
Oracle Database Backup
Oracle Database BackupOracle Database Backup
Oracle Database Backup
 
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
 
Less04 Instance
Less04 InstanceLess04 Instance
Less04 Instance
 
Kp.3 pengaturan sistem dan user
Kp.3 pengaturan sistem dan userKp.3 pengaturan sistem dan user
Kp.3 pengaturan sistem dan user
 
Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2
 
17398351 sap-system-copy-homcopyv1
17398351 sap-system-copy-homcopyv117398351 sap-system-copy-homcopyv1
17398351 sap-system-copy-homcopyv1
 
Less04 instance
Less04 instanceLess04 instance
Less04 instance
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
 
Les 06 Perform Rec
Les 06 Perform RecLes 06 Perform Rec
Les 06 Perform Rec
 
Creating a physical standby database 11g on windows
Creating a physical standby database 11g on windowsCreating a physical standby database 11g on windows
Creating a physical standby database 11g on windows
 

More from Osama Mustafa

More from Osama Mustafa (15)

Case study for software architect
Case study for software architectCase study for software architect
Case study for software architect
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Does cloud mean the end of the dba
Does cloud mean the end of the dbaDoes cloud mean the end of the dba
Does cloud mean the end of the dba
 
Using git hub for your code
Using git hub for your codeUsing git hub for your code
Using git hub for your code
 
DevOps Project
DevOps Project DevOps Project
DevOps Project
 
Java business service
Java business serviceJava business service
Java business service
 
Steps creating data_integration_services
Steps creating data_integration_servicesSteps creating data_integration_services
Steps creating data_integration_services
 
Build, Deploy and Run Node Js Application on Azure using Docker
Build, Deploy and Run Node Js Application on Azure using DockerBuild, Deploy and Run Node Js Application on Azure using Docker
Build, Deploy and Run Node Js Application on Azure using Docker
 
Helping implementer dealing with famous siebel based system messages and er...
Helping implementer dealing with famous siebel   based system messages and er...Helping implementer dealing with famous siebel   based system messages and er...
Helping implementer dealing with famous siebel based system messages and er...
 
Weblogic and docker
Weblogic and dockerWeblogic and docker
Weblogic and docker
 
Weblogic 101 for dba
Weblogic  101 for dbaWeblogic  101 for dba
Weblogic 101 for dba
 
Oracle obia 11.1.1.10.1 installation
Oracle obia 11.1.1.10.1 installation Oracle obia 11.1.1.10.1 installation
Oracle obia 11.1.1.10.1 installation
 
OBIA Installation
OBIA Installation OBIA Installation
OBIA Installation
 
How to apply new patch on siebel 8.2.2.4
How to apply new patch on siebel 8.2.2.4How to apply new patch on siebel 8.2.2.4
How to apply new patch on siebel 8.2.2.4
 
Weblogic 12c installation (oracle linux)
Weblogic 12c installation (oracle linux)Weblogic 12c installation (oracle linux)
Weblogic 12c installation (oracle linux)
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

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.