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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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