How to restore and recover your database

Assignment Help Basic Computer Science
Reference no: EM13215380

An open (hot) database backup is made with database running in ARCHIVELOG mode. This kind of backup can be performed while the database is open and the users are working with the database, thus it is also called online backup. Online backups are done by placing a tablespace in backup mode, copying it somewhere else on disk or tape, and then taking the tablespace out of backup mode. After backing up tablespaces, you can backup the control file. Upon completing this lab exercise, you will know how to take a hot backup of your database, and how to restore and recover your database after a simulated media failure.

IMPORTANT: Be sure you have the database in ARCHIVELOG mode before starting.

Creating a SPOOL session: Be sure that you start a spool session before you start executing your SQL code when working on the lab. This will be the only way to capture the results of your work and will be required for grading. Because of the nature of this lab, it is best to do the lab in one sitting. This will minimize the possibility of causing a problem with the database.


iLAB STEPS


Step 1: Take a Hot Backup of the Database

Back to Top

A hot backup consists of datafiles, controlfiles, and archive redo logs. An online backup never contains online redo logs. First, you need to backup the datafiles by putting each tablespace in backup mode. To do this, you will use the following command:

ALTER TABLESPACE tablespace_name BEGIN BACKUP;

You want to backup all of your available tablespaces with the exception of the temporary tablespace. When you are finished, you should have five alter statements and have all five tablespaces in backup mode.

To verify that each tablespace is in backup mode, query the V$BACKUP dictionary view to get the file number and status for each tablespace. Your result set should look similar to the following.


FILE#

STATUS


-------- -----------
1 ACTIVE
2 ACTIVE
3 ACTIVE
4 ACTIVE
5 ACTIVE

Next, you need to take care of backing up the actual data files. Since you are in a Windows environment, you can simply copy/paste the actual data files from their current location in the directories under the ORADATA directory in your OFA structure to the directory named BACKUP. When finished, you should have all five of the datafiles in the directory call BACKUP.

Now, you need to take the tablespaces out of backup mode. To do this, you will need to use an ALTER TABLESPACE statement again, only this time you will need to specify END BACKUP after the tablespace name. When finished, verify that none of the tablespace are still in backup mode by querying the V$BACKUP view again. Your result set output should look similar to the following.


FILE#

STATUS


-------- -----------
1 NOT ACTIVE
2 NOT ACTIVE
3 NOT ACTIVE
4 NOT ACTIVE
5 NOT ACTIVE

The final step in this process will be to issue an ALTER SYSTEM SWITCH LOGFILE command several times to create some archived log files for the actions you just took the database through.


Step 2: Back Up the Control Files and Archive the Redo Logs

Back to Top

Now you need to get backups of the control file and another set of archived log files. To back up the control file, you will need to issue a ALTER DATABASE command specifying to BACKUP CONTROLFILE and then give the complete directory path to the backup folder. Your complete command should look similar to the following (remember to use your database instance name, file path, and a file name for the backup).

ALTER DATABASE BACKUP CONTROLFILE TO 'F:DBMFALLADB104ORACLEADMINBACKUPfilename.bkp';

Go to your BACKUP folder in the OFA structure for your database instance and verify that the file is there.

Now issue a logfile switch command enough times to cycle through all three log groups.


Step 3: Simulate a Media Failure

Back to Top

Now, you are going to simulate a media failure. This type of failure can happen when a hard drive crashes or becomes corrupt, or a file becomes corrupt and unusable.
a. First, shut down the database. To save time, you can issue a SHUTDOWN ABORT.
b. Now go to your OFA structure and rename the USERS01.dbf file to USERS01.dbf.old. If you get an error message stating that the file is in use by another application and access is denied, then exit out of SQL*Plus to stop the session and try to rename the file again.
c. Next, attempt to start your database instance up again using your initdb###.ora file. You should get an error at this point so shutdown the instance again.
d. Go to your bdump directory of your OFA structure and open your alert log file. Find the place within the log listing that addresses the error caused by not being able to find the file you changed the name of. Copy that listing into notepad and hold on to it for the end of the lab. Your listing should look similar to the following.


Errors in file f:dbmspringbdb1000oracleadminbdumpdb1000_dbw0_5700.trc:
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: 'F:DBMSPRINGBDB1000ORACLEADMINORADATADISK1USERS01DV001.DBF'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.

 

Step 4: Restore and Recover the Database

Back to Top

Now, we are going to do some magic and get the database back up and running using the backups that you created earlier.
a. Make sure that you have shutdown the database instance as instructed in Step 4. Copy just the data files (the five files with the .dbf extension) from the backup directory to the correct disk folder in your OFA structure. Be sure that you get them back in the disk folder that they belong in.
b. Now attempt to start your database instance back up using your initdb###.ora file. There still seems to be a problem so shutdown the instance again.
c. Now attempt to start your database instance in MOUNT mode using your initdb###.ora file. Query the V$RECOVER_FILE dictionary view to find out which file has a problem and what the error is. Your result set should look similar to the following.

 

FILE#

ERROR


-------- -----------
1
2
3
4
5


d.Now, we need to recover the database and get back to where we want to be. Issue a RECOVER DATABASE command. When prompted for archived redo, hit the enter key (you do not need to type anything in) until Oracle cannot find any more archived redo logs to apply. At this point, you should see a message stating "Media recovery complete".
e.Now, open the database using an ALTER DATABASE OPEN command. Congratulations - you have just brought your database back from the dead.

This concludes the Lab for Week 7. Be sure to enter a SPOOL OFF command to end your spool session and save your output file.

 

Reference no: EM13215380

Questions Cloud

What is the adjustment at the end of the accounting period : north slope realty co. pays weekly salaries of $7900 on Friday for a five day week ending on that day. What is the adjustment at the end of the accounting period, assuming that the period ends on (a) Wednesday, (b) on Thursday
Compare and contrast the respective role of pop psychology : compare and contrast the respective role of pop psychology with the science of psychology in contemporary society
What is the dollar-weighted duration of the bank''s liability : What is the dollar-weighted duration of the bank's liability portfolio if the bank wants to maintain zero leverage - adjusted duration gap?
Compute the federal tax return for the deckers : Paul and Donna Decker are married taxpayers, ages 44 and 42, who file a joint return for 2013. The Deckers live at 1121 College Avenue, Moab, Utah 84632. Paul is an assistant manager at Moab Motor Inn, and Donna is a teacher at Carmel Elementary S..
How to restore and recover your database : Because of the nature of this lab, it is best to do the lab in one sitting. This will minimize the possibility of causing a problem with the database.
Product-product line or service : our paper should include a description of the chosen product, product line, or service and a rationale for choosing that product or service. Consider the ability of that product or service to compete in the markets.
Explain bank''s asset portfolio and liability portfolio : What is the weighted average duration of bank's asset portfolio and liability portfolio? What is the leverage-adjusted duration gap?
What are the pros and cons of relocating : What motivations typically cause firms to initiate a facilities location or relocation project and what are the pros and cons of relocating a small or midsized manufacturing firm (that makes mature products) from the United States to China?
What are some technologies and solutions : What are some technologies and solutions that can be used to reduce risk for the "Cloud" or "Cloud Data"

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Goals of system monitoring urban weather and pollution

What goals would you have for the system besides monitoring urban weather and pollution? What legal and ethical concerns should you understand prior to deploying the network?

  Merging transaction and analytical processing problem occurs

When merging transaction and analytical processing a problem occurs. Real-time analytical processing diminishes the performance of transaction processing. What is the solution to this problem that many companies use?

  Program that reads a series of whitespace

Write a program that reads a series of whitespace delimited strings from stdin and prints them back out, separated by spaces, in lexicographic order. You may assume that all strings are lower case and that no string has more than 20 characters.

  Condition to resume sending messages related to application

Give an example that illustrates why P must not be allowed to do so and state a condition that defines when P may resume sending messages related to application.

  The recommended entry strategy into international markets

An expert system is used to determine whether the recommended entry strategy into international markets should be Investment (I), Contractual (C), or Export (E).

  Techniques attacker use to access information on system

Recognize all potential security threats on home personal computer. Recognize some of techniques the attacker might use to access some information on system.

  What are some of the unique features that become available

What are some of the unique features that become available when either the forest or the domain is changed to the 2008 functional level? What about 2008 R2? What features are lost when moving to either of the 2008 functional levels?

  Write a command to do an alphabetical sort on the third fiel

Write the command to run the file called 'process' assuming it is in your current directory, has execute permission, but that your current directory is not in the standard path command search list:

  Discuss why the user needs are important or stood out

Cite specific examples from readings. Include personal experience with the topic if appropriate

  What is the public interface of the counter class

what is the public interface of the counter class in section instance variables and encapsulation? How does it differ from the implementation of the class?

  Explore and estimate software programs

Explore and estimate software programs based on following criteria: Needs assessment -- Why would the prospective user require program? Write down the features of the program?

  Write a method called median

Write a method called median that accepts an array of integers as its argument and returns the median of the numbers in the array. The median is the number that will appear in the middle if you arrange the elements in order

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd