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

  Write an application to test class rectangle

The set accessor should verify that length and width are each floating-point numbers greater than 0.0 and less 20.0. Write an application to test class Rectangle.

  Convert 6bd3h into its binary and decimal equivalent

Convert 6BD3H into its Binary and Decimal equivalent

  Develop a scanner object in main method

Assume that inside main method below you make decision to develop a Scanner object, and then read in int and then double on one line, where two values are separated by space.

  Determine features of ram to include in web server

Determine the features and capacities (RAM, disk storage, processor speed) that Amy should include in the Web server computer that she will need for her site.

  To perform queries

To perform queries on a relational database system using SQL? To demonstrate an advanced knowledge of stored procedures, stored functions and triggers.

  Write an appropriate me expression capturing the essence

Write an appropriate ME expression capturing the essence

  Determining contents of the register a

The hexadecimal form of a 3-byte instruction for SIC/XE is 010030. The opcode in the instruction is LDA. Indicate the contents of the register A in decimal.

  We are interrupted or disintegrated

Research is compelling that it takes us approximately 4 to minutes return to our work with the same level of through processes whenever we are interrupted or disintegrated. Is it possible to information is fairly constant?

  Recognize interface metaphor to use for conceptual design

For conceptual design (architectural or high-level), recognize the interface metaphor to use, interaction type(s) to employ, and interface type(s) to follow. For each of these, make sure to describe why you select what you did.

  Propose three to five additional activities

Propose three to five additional activities you think should be added to a Gantt chart to help you estimate resources and durations. Write a one-page paper describing these new activities.

  For the aside element create a style rule to

float the aside element on the right with a margin of 10 pixels; set the width to 50% of the width of the main section; and add a rounded border with a radius of 30 pixels. For paragraphs within the aside element, set the font size to 90% and the ..

  Submit the flowchart of your working program.

Also submit the flowchart of your working program. Make sure you run it to make sure it is error free and does what it is supposed to.

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