Free Newsletters:
DatabaseJournal  
DBANews
Database Journal
Search Database Journal:
 
HOME News MS SQL Oracle DB2 Access MySQL PostgreSQL PHP SQL Etc Scripts Links Discussion
internet.com

» HOME
» NEWS
» FEATURES
» SERIES
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Products
Scripts
Links
» DISCUSSION
» TECH JOBS

Marketplace Partners
Be a Marketplace Partner




internet.commerce
Be a Commerce Partner
Server Racks
GPS Devices
KVM Switch over IP
Promotional Products
Corporate Gifts
Condos For Sale
Boat Donations
Web Hosting Directory
Laptop Batteries
Hurricane Shutters
Logo Design
Desktop Computers
KVM over IP
Online Education




MySpace Joins eBay, Yahoo in Open Profile Push

News Corp. Unit Under Fire for Ties to Hacker

Are Non-PC Devices Hurting 'Net Innovation?

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Linked Data Planet Conference & Expo

CA ERwin® Data Modeler Proven database design and modeling. Efficiently analyze, design and deploy effective database solutions. Whitepaper: Manage SQL Server Deployments
Try it free: CA ERwin® Data Modeler


Solaris 8 Migration Assistant
Rapidly move your Solaris 8 application environments to new systems running Solaris 10 with the Solaris 8 Migration Assistant. Reduce migration risk while taking advantage of increased performance, reliability and security of the latest SPARC hardware platforms and Solaris 10 OS. »

 
Sun Eco Innovation: Good for Business, Good for the Environment
A complete solution to help you optimize and refresh your datacenter while properly recycling equipment and eliminating eWaste, including money-saving promotions to lower hardware acquisition costs. »

 
Sun Eco Innovation: Power Calculators
Power consumption has increasingly become a priority in customer's minds when purchasing new systems or storage. Sun's Power Calculators provide data on power consumption of Sun products allowing IT managers to better plan the power requirements in the datacenter to achieve better energy and cost savings. »

 
Optimize the Web Tier: Consolidate to Get More Performance in Less Space and Lower Power Consumption
Expansion in the Web tier is generally accomplished by adding more servers whenever extra capacity is needed. As the pool of servers grows larger, however, the complexity of the environment can grow exponentially. »
Related Articles
Recovering from Loss of All Control Files

Production Manager (hands on)
Aquent
US-MA-Cambridge

Justtechjobs.com Post A Job | Post A Resume
Oracle
March 10, 2008
Hands-on Oracle: Backup & Recovery Games
By Steve Callan

Games in Oracle? No, the games reference here is like the “games” in Olympic Games. The athletes competing in games at that level are serious about what they do, and you can pretty much bet the farm they are passionate about their sport or event as well. As an Oracle DBA, how serious – and passionate – are you about your job? Is job even the right word here? For serious practitioners, profession is probably a better choice. The “games” or events we’re going to play, more specifically, what we learn from them, in this article are practical and necessary skills a DBA should have at his or her disposal.

Loss of one or more special files

Special files in our world are the following: control files, online redo logs, archived redo logs, and datafiles. Let’s say you have several control files, identified (of course) in the initialization parameter file (I’ll use a pfile for this article for quicker editing). You’ve read about it a million times: if you lose a control file, the recovery or fix consists of copying the (or “a”) good one into the errant file’s location, or remove the reference to the file from the parameter file. After a control file is lost (for whatever reason), what happens to the database?

1.  Operations can still take place, having other control files “online” means you can survive the loss of one or more control files

2.  You (the DBA) have to shutdown, restore the file (or remove it from the init.ora file) and startup

3.  Oracle shuts down/the instance is terminated (i.e., you have no control over that; it’s happening whether or not you like it)

The reason I ask is this: what is the difference between control files and online redo logs in terms of multiplexing them? For instance, what happens to the database (or instance) if a member of the active group is lost? Does Oracle keep going, or do things come to a screeching halt? In the following experiment, I’ll place control03.ctl onto a flash drive, bounce the instance, and then pull the flash drive out of the USB port to simulate media failure.

Current listing of control files

 
*.control_files='D:\oracle\product\10.2.0/oradata/db10/\control01.ctl',
                'D:\oracle\product\10.2.0/oradata/db10/\control02.ctl',
                'D:\oracle\product\10.2.0/oradata/db10/\control03.ctl'

New listing of control files

 
*.control_files='D:\oracle\product\10.2.0/oradata/db10/\control01.ctl',
                'D:\oracle\product\10.2.0/oradata/db10/\control02.ctl',
                'F:\oracle\control03.ctl'

Confirmation of the new control file:

SQL> startup
ORACLE instance started.
 
Total System Global Area  289406976 bytes
Fixed Size                  1290184 bytes
Variable Size             104857656 bytes
Database Buffers          176160768 bytes
Redo Buffers                7098368 bytes
Database mounted.
Database opened.
SQL> col name for a52
SQL> select name from v$controlfile;
 
NAME
----------------------------------------------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\DB10\CONTROL01.CTL
D:\ORACLE\PRODUCT\10.2.0\ORADATA\DB10\CONTROL02.CTL
F:\ORACLE\CONTROL03.CTL

Now I’m ready to disconnect the flash drive. With no direct warning (nothing raised to the user interface until an operation is attempted), the instance crashes.

SQL> select name from v$controlfile;
select name from v$controlfile
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel

The alert log shows the following (plus much more; this is the relevant part):

Thu Mar 06 12:41:15 2008
Errors in file d:\oracle\product\10.2.0\admin\db10\bdump\db10_ckpt_2756.trc:
ORA-00206: error in writing (block 3, # blocks 1) of control file
ORA-00202: control file: 'F:\ORACLE\CONTROL03.CTL'
ORA-27072: File I/O error
OSD-04008: WriteFile() failure, unable to write to file
O/S-Error: (OS 1006) The volume for a file has been externally altered so that the opened file is no longer valid.
…some more messages…
Thu Mar 06 12:41:29 2008
Instance terminated by CKPT, pid = 2756

The fix part is easy, well known, and well documented elsewhere, but were you absolutely certain what actually happens when a control file is lost?

Fix the problem, reconnect and startup

 
SQL> prompt Remove the reference to control03
SQL> startup
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
SQL> conn sys/oracle as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area  289406976 bytes
Fixed Size                  1290184 bytes
Variable Size             104857656 bytes
Database Buffers          176160768 bytes
Redo Buffers                7098368 bytes
Database mounted.
Database opened.
SQL>

Coming back to online redo log files, is the loss of a member survivable, that is, does the instance crash like it did for loss of a control file? The answer is: it depends. A group can have one or more members. Let’s look at #members = 1. Like the previous example, I’ll create a group with a member on a flash drive, and make that group the active group (what is the meaning of STATUS for the values of ACTIVE, CURRENT, INACTIVE and UNUSED?). Once the group is active, I’ll pull the plug. More than one way to do this, but what is the current redo log group? From the alert log:

Extract from the alert log

 
Thu Mar 06 13:22:11 2008
Thread 1 advanced to log sequence 211
  Current log# 10 seq# 211 mem# 0: F:\ORACLE\REDO10.LOG

Just like the loss of a control file, the instance is terminated.

SQL> select * from v$logfile;
    GROUP# STATUS  TYPE    MEMBER                                               
---------- ------- ------- ------------------------------------------------
         7         ONLINE  D:\ORACLE\PRODUCT\10.2.0\ORADATA\DB10\REDO07.LOG
         8         ONLINE  D:\ORACLE\PRODUCT\10.2.0\ORADATA\DB10\REDO08.LOG
        10         ONLINE  F:\ORACLE\REDO10.LOG                                 
         9         ONLINE  D:\ORACLE\PRODUCT\10.2.0\ORADATA\DB10\REDO09.LOG
SQL> select * from v$logfile;
select * from v$logfile
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel

In this case, it was LGWR that was responsible for terminating the instance. Note that it was CKPT in the other example. What gets recorded in the control file? The SCN. Which process stamps the control file with the SCN? The checkpoint process.

If trying this at home, running the database is noarchivelog mode, and using only one member in the current group, what will it take to be able to open the database again?

Had that group been multiplexed, and the same file was “pulled” from the system, what happens? Life goes on, and the alert log is written to with a message about the missing member. Let’s add a second member to group 10, placing it on a different (i.e., permanent) drive, and then pull the flash drive again (that should be a hint about what it takes to open the database).

Here is what the alert log shows:

Thu Mar 06 14:51:45 2008
Thread 1 advanced to log sequence 216
  Current log# 10 seq# 216 mem# 0: F:\ORACLE\REDO10.LOG
  Current log# 10 seq# 216 mem# 1: D:\ORACLE\PRODUCT\10.2.0\ORADATA\DB10\REDO11.LOG
Thu Mar 06 14:53:36 2008
Errors in file d:\oracle\product\10.2.0\admin\db10\bdump\db10_lgwr_2224.trc:
ORA-00345: redo log write error block 23 count 2
ORA-00312: online log 10 thread 1: 'F:\ORACLE\REDO10.LOG'
ORA-27072: File I/O error
OSD-04008: WriteFile() failure, unable to write to file
O/S-Error: (OS 1006) The volume for a file has been externally altered so that the opened file is no longer valid.
Thu Mar 06 14:53:36 2008
Errors in file d:\oracle\product\10.2.0\admin\db10\bdump\db10_lgwr_2224.trc:
ORA-00343: too many errors, log member closed
ORA-00346: log member marked as STALE
ORA-00312: online log 10 thread 1: 'F:\ORACLE\REDO10.LOG'

The best part about the messages is the lack of two words: Instance terminated. After a shutdown and startup, the alert log will still “complain” about the missing file, but the bottom line is that the database will be open.

Thu Mar 06 14:56:51 2008
ALTER DATABASE OPEN
Thu Mar 06 14:56:52 2008
Errors in file d:\oracle\product\10.2.0\admin\db10\bdump\db10_lgwr_2288.trc:
ORA-00313: open failed for members of log group 10 of thread 1
Thu Mar 06 14:56:52 2008
Errors in file d:\oracle\product\10.2.0\admin\db10\bdump\db10_lgwr_2288.trc:
ORA-00313: open failed for members of log group 10 of thread 1
Thu Mar 06 14:56:52 2008
Thread 1 opened at log sequence 216
  Current log# 10 seq# 216 mem# 1: D:\ORACLE\PRODUCT\10.2.0\ORADATA\DB10\REDO11.LOG
Successful open of redo thread 1
…some other messages…
Thu Mar 06 14:56:59 2008
Completed: ALTER DATABASE OPEN

Loss of datafiles

So far, recovering from loss of a control file or redo log file is pretty close to losing no data. The single member redo log group example is a case where data loss can take place. With respect to datafiles, there are two kinds: the ones that matter to you (your data) and the ones that matter to Oracle (its data). To clarify this categorization, here are two questions:

1.  What happens if one your tablespaces loses a datafile?

2.  What happens if the SYSTEM tablespace, as an example of an owned-by-Oracle tablespace, loses a datafile?

If you answered those questions as is, what was your frame of reference with respect to archiving? If you didn’t consider archiving when formulating your answers, then you stand a 50-50% chance of having been wrong.

If operating in NOARCHIVELOG mode, and you lose a datafile – any datafile – it’s game over, instance terminates. If operating in ARCHIVELOG mode, then the answers to the two questions above are different: loss of your datafile means the instance keeps going, loss of an Oracle specific datafile means the instance is terminated. The section titled “Recovering After the Loss of Datafiles: Scenarios” in the Backup and Recovery Advanced User’s Guide spells this out quite nicely.

In Closing

Pretty much all of the backup and recovery scenarios related to loss of special files can be replicated on a PC using a very inexpensive flash drive. Whether on an AIX 5300L gazillion CPU machine with a gazillion megabytes of RAM or on your personal desktop/laptop that just barely runs Oracle, the principles are virtually the same. Give it a try and see for yourself. These are drills best practiced without the pressure of having to do these things when your instance is crashed and time is money.

» See All Articles by Columnist Steve Callan

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

Oracle Archives

Download: Solaris 8 Migration Assistant. Run Solaris 8 apps on the latest SPARC systems and Solaris 10.
Whitepaper: Enterprise Information Integration--Deployment Best Practices for Low-Cost Implementation
Webcast: Five Virtualization Trends to Watch. Produced for HP, Citrix, and Intel.
HP eBook: Using Business Service Management (BSM) to Manage Your Business Applications
What's The Future Of IT? Find Out By Reading "IT in 2018" Now. Free Registration Required.


Latest Forum Threads
Oracle Forum
Topic By Replies Updated
GET DATA FROM .DBF FILE, ORACLE 9i revelation 5 May 5th, 10:55 AM
Could not locate Java runtime. Oracle installation error revelation 0 April 10th, 12:06 AM
Database Backup junOOni 4 March 20th, 06:28 AM
Helpme to How to Write Text File intelram_18 1 March 17th, 02:54 PM







JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES