Performing Cold Backup On Oracle 10g
Performing Cold Backup On Oracle 10g
we set our oracle-SID to ahmed and then, checked to make sure it is ahmed, after connecting as sysdba, we checked the name of our database and its current log_mode, and it is in noarchivelog state; Meaning, not in a hot backup mode. We will first make a scenario to understand how cold backup functions: We mentioned earlier that cold backup is saving oracle control files, redo logs, and data files for a specific point; Meaning, if we performed a cold backup now, and later, created some new tables and inserted data to, and after doing so, our database crashed for any reason and we restored the cold backup, we will only restore our database at the point when it was backed up, the recently inserted information are lost. So for this purpose, we will backup our database now, and after performing the cold backup, we will create a table and name it emp, and insert some records into it. When our table creation is finished, we will insert couple of records, and save. After saving, we will delete our database files to cause a crash, and restore our cold backup, and observe the difference.
Let's begin our journey now: Lets first make a folder and call it cold_backup, and it is where our files will be stored:
We made a directory in drive E and called it cold_backup as it appears in the picture above. To perform a cold backup, we need to make sure our database is in noarchivelog mode, and to make sure, we can query v$database view through the following command:
Since it is not in the archive log, we can perform our cold backup; we need to do the following steps: 1- shutdown the database 2- locate our database files, and in this case, it is location: e:\oracle\product\10.2.0\oradata\ahmed\ 3- copy all the files from ahmed folder into our cold_backup folder. Shutting down the database:
we also can just say shutdown or shutdown abort in case if we want to speed up the shutdown. Locating our files:
disregard the archived_logs folder because it was made to keep track of logs when my database was in the archive log mode. We dont need it now. Copying all the database files into E:\cold_backup\ folder:
we have copied all the files, and lets double check with the cold_backup folder:
Let's now continue our scenario and connect to the database and create our table emp and insert some records into it:
We have created our table and inserted some records into it. please be aware, this modification is taken place after the cold backup is performed, which means the cold backup doesn't contain the table. Lets now shutdown and delete all the files in the ahmed folder, which is the folder where our database files are stored:
we have deleted all the files, now if we try startup our database, we will get an error because the control files cannot be located; lets check to see:
7
ok, now we should shutdown the database in case if it is opened, and it isn't open now, and copy all the files from the cold_backup folder back to their original folder Ahmed, and then, try to restart our database:
all the files are copied to their original location and let's double check the ahmed folder to make sure all the files are there:
The database is open, but the question is: Since we created a table and inserted some records into it, will it appear knowing we performed our cold backup before its creation?
So, I hope the idea is clear now. the cold backup restores the database to the point of its backup. anything comes after the cold backup is lost if cold backup is the only method applied to save the database, and it is also among the old perhaps dying methods used, but knowing it is very important. Who uses cold backup? Usually small businesses or individuals that don't need complicated servers and database environment use this method to keep backup archives of their database and of course knowing the database and the time of taking the cold backup is very important.
I hope this lesson is clear enough for the reader. Prayer for me please.
11