The Oracle database uses two very important files for database support, stability, and recovery. The Control file is one of the most important files in the database, as it is the file that keeps track of where everything is and where it should be at any given time. Since the database itself only needs one Control File to operate with, multiplexing the Control File is a very important part of the Oracle Architecture. In this lab, you will create a third Control File for the database.
Another essential file structure for successful operation of an Oracle database is the Redo Log file. This file contains listings of every transaction that takes place in the database, and it is essential in database recovery and restoration. Log Files exist in Log Groups, and each Log Group must have at least one file--although it is recommended that there be a minimum of two per group and that they exist on separate disks. In this lab, you will also create a new Log Group containing two files.
The following steps will outline the processes needed to complete this lab. Keep in mind that the file paths shown in the lab specs may vary slightly from your file paths, depending on the database instance you have. The expected results examples given in each step are provided as a guide only. The specific results of your work may vary slightly, but should be similar enough to determine whether or not you have successfully completed the step.
VERY IMPORTANT – Setting up for your lab
Creating a SPOOL session: Be sure that you start a spool session before you start executing your SQL code when working on the lab. Your SPOOL file name should be DATABASE_lab3. If you do the lab in several sessions, be sure that you use a different file name so as not to overwrite the existing file (for example DATABASE_lab3, DATABASE_lab3a, DATABASE_lab3b etc.)
L A B S T E P S |
Part 1 -- The Control File: Adding a new Control File Step 1: Locating the existing control files |
Where is the existing control file located and what is the name?
Hint: Query the dynamic performance view V$CONTROLFILE or V$PARAMETER, or execute the SHOW PARAMETER command to display the name and location of the control file.Your response will look similar to this:
NAME
------------------------------------------------------------ -------------------
F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK1\ctl1001. ctl
F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK2\ctl1002. ctl
2 rows selected.
Step 2: Add a new control file |
Hints:
- In your current SQL*Plus session, issue the command to shut down the database.
- On your mapped network drive, go to the DISK1 directory and physically copy the existing control file in that directory to the directory DISK3. Rename the file to CTLtest3.ctl
- Next, go to your initol###.ora file found in the PFILE directory of your mapped drive. Modify the “Control files” parameter to include the new file name, so that your parameter listing looks similar to the one below. (You will be adding a third control file path in the parameter listing for the control file). Your new listing should look similar to the one below.
Control_files=(‘F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\ DISK1\ctl1001.ctl’,
‘F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK2\ctl1002. ctl',
‘F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ ORADATA\DISK3\ctltest3.ctl’)
- Save the control file.
- Now go back to yrou SQL*Plus session and issue the STARTUP command to restart the database, using your init.ora parameter file with the new setting. Your startup command should look similar to the following:
startup pfile= O:\oracle\admin\pfile\init###.ora
Step 3: Verify the new control file |
Your response will look similar to this:
NAME
------------------------------------------------------------ -----------
F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK1\ctl1001. ctl
F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK2\ctl1002. ctl
F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK3\ctltest3. ctl
2 rows selected.
Step 4: Recovering from a corrupted Control file |
- To begin, issue a SHUTDOWN IMMEDIATE (make sure you are logged in as the SYS user).
- Next, go into your mapped directory structure and find the ctltest3.ctl file in the Disk3 folder. Right-click on the file and select Open With => Notepad from the options list. When the file opens, press the space bar once and then close and save the file. You have just corrupted your database!
- Now, once again, start up your database using the init.ora file for your instance, as you did in step 2. What happened? Did the database start? Go find your alert log (Hint: bdump folder in your OFA structure), copy the part of the entry that references the problem (look down at the bottom of the file), and save it to a text file to be turned in with the lab work.
- Ok, so now we need to fix this problem. Execute the following steps to recover your database from this problem.
- First, shut down the database by issuing a SHUTDOWN IMMEDIATE.
- Next, go back into your init.ora file in your mapped directories and remove the line that you just added that has the path to the ctltest3.ctl file. Make sure that you have both original files in single quotes with a comma separating them, and that there is not a comma at the end before the closing parenthesis. Close the file and save it.
- Now go back to the SQL*Plus editor and start up your database using the init.ora file, as you have done before.
Part 2 -- The Redo Logs: Working with Redo Logs Step 5: Find the location of existing Redo Log files and Groups |
List the number and location of existing log files and display the number of redo log groups and members your database has:
Hints:Your response will look similar to this for A.
- Query the dynamic performance views V$LOGFILE to display the location.
- Use the dynamic performance view V$LOG to display the number of redo log file groups and members.
MEMBERYour response will look similar to this for B.
------------------------------------------------------------ --------
F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK2\LOG1A01. RDO
F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK3\LOG2A01. RDO
2 rows selected.
GROUP# MEMBERS
---------- ------------
1 1
2 1
2 rows selected.
Step 6: Determine current Archive Mode |
Hint: Query the dynamic performance views V$DATABASE to show the database mode.Your response should look similar to this:
LOG_MODE
---------------
NOARCHIVELOG
1 row selected.
Step7: Determine if Archiving is enabled |
Hint: Query the dynamic performance views V$INSTANCE to verify if the archiving is enabled.Your response should look similar to this:
ARCHIVE
---------
STOPPED
1 row selected.
Step 8: Adding Redo Log Members |
Hint: Execute the ALTER DATABASE ADD LOGFILE MEMBER command to add a redo log member to each group. Then query the dynamic performance views V$LOGFILE to verify your result.Your response should look similar to this:
Database altered.
Database altered.
GROUP# STATUS MEMBER
--------- -------- ------------------------------------------------------------ ----
1 STALE F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK2\LOG1A01. RDO
2 F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK3\LOG2A01. RDO
1 INVALID F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK3\LOG1B01. RDO
2 INVALID F:\DBM\FALLA\DB9999\ORACLE\ADMIN\ORADATA\DISK2\LOG2B01. RDO
4 rows selected.
Step 9: Add a new Log Group |
Your response should look similar to this:
Hint: Execute the ALTER DATABASE ADD LOGFILE GROUP command to create a new group. Remember that you can add both files to the new group at one time. To verify your work, query the performance view V$LOG.
Database altered.Now, to verify your work, query the performance view V$LOG.
Your response should look similar to this:
GROUP# MEMBERSThis concludes the Lab for Week 3. Be sure to enter a SPOOL OFF command to end your spool session, to save your output file.
---------- ----------
1 2
2 2
3 2
3 rows selected.
No comments:
Post a Comment