Showing posts with label Backup and Recovery. Show all posts
Showing posts with label Backup and Recovery. Show all posts

April 07, 2009

How to Recover Controlfile

Recover controlfile in Archive log mode:

1. connect the database and verify contfile names
SQL> select name from v$controlfile;
NAME
-------------------------------------------------------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\CONTROL01.CTL
D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\CONTROL02.CTL
D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\CONTROL03.CTL

2. Remove one controlfile: CONTROL01.CTL

3. SQL> startup

ORACLE instance started.
Total System Global Area 432013312 bytes
Fixed Size 1249392 bytes
Variable Size 155193232 bytes
Database Buffers 268435456 bytes
Redo Buffers 7135232 bytes
ORA-00205: error in identifying control file, check alert log for more info

4. Verify in alert log:

ORA-00202: control file: 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\CONTROL01.CTL'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.

5. Copy other controlfile adn rename is as orignal ,becuase database is using multiple controlfiles.

cp CONTROL02.CTL and rename it to CONTROL01.CTL

6. Create a "create control file script". This can be obtained using "Alter database backup controlfile to trace" command if used some time back. Its a good practice to backup the control file to trace regularly when ever the structure if changed (Example when ever a datafile is added). other waise take from

control_file.sql:
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "PRIM" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 (
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\REDO01.LOG',
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\REDO01B.LOG'
) SIZE 50M,
GROUP 2 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\REDO02.LOG' SIZE 50M,
GROUP 3 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\REDO03.LOG' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\SYSTEM01.DBF',
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\UNDOTBS01.DBF',
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\SYSAUX01.DBF',
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\USERS01.DBF',
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\PRIM\USERS02.DBF'
CHARACTER SET WE8MSWIN1252
;


7. Run the created control_file.sql

SQL> @control_file.sql
ORACLE instance started.
Total System Global Area 432013312 bytes
Fixed Size 1249392 bytes
Variable Size 155193232 bytes
Database Buffers 268435456 bytes
Redo Buffers 7135232 bytes
Control file created.

8. Open the database resetlogs

SQL> ALTER DATABASE OPEN RESETLOGS;
Database altered.

9. The add the tempfile
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE 'D:\ORACLE\PRODUCT\10.2.0

\ORADATA\PRIM\TEMP01.DBF' SIZE 20971520
REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;

Tablespace altered.

We are done. Database is now up and running. There is no loss of data, because all the data files and redo log files were intact.


Note: if all the controlfiles are corrupted,follow same procedures except step 5.

October 24, 2008

Backup and Recovery interview questions


What is Restricted Mode of Instance Startup ?
To Enable Restricted SessionAlter system enable restricted session;To Disable Restricted SessionAlter system disable restricted session;To Start the Database in Restricted ModeSTARTUP RESTRICT


What is the disk migration?what is the steps involved in disk migration?
Disk migration is noting but, migration of data from one OS dependent database to another Dependent database. The steps involved in this are- first go to your target database and export all your data into flat files-next in the destination database during the installation of the database, it asks for data source ,instead of giving the data of the oracle provided , give the path of the flat file you exported previously .


What do you mean by MEDIA RECOVERY..?
When physical disk fail, physical database file corrupt then media recovery required


What is the difference between media recovery & crash recovery..?
Media recovery is a process to recover database from backup when physical disk failure occure.crash recovery is a automated process take care by oracle when instance failure occure.


What are the different tools available for hot backups. Is it preferable to take it manually all the time or it depends on the size of the database.
See A hot backup can be done by either RMAN,User Managed Backups by puting tablespace in backup mode my OEM which does the same as the user managed backup.But the Backup depends upon the size of the database you are using . if the database size in TB the RMAN backup will take more than 10 hours to complete and if the database is critical you can' wait for long to go for so long in this case their are special backup techniques which are given by vendors like TIVOLI and Netbackup they provide BC Vol backup called Business content Volumn Sync which copies a snapshot of the primary data to another place and backsup the database from one SAN to another with in 15 min for 2 TB of database and is the preferable method for big companies.


What is the difference between recovery and restoring of the database.
Here is a scenario to understand Restore & Recovery

Sunday 10pm : Database is backed up. and is running fine. Monday 11am : Went down / crashed due to some reason. To bring up the database, we have 2 options:1. Simple Restore : copying files from backup taken sunday night and open the database. Here, we loose all the changes that are done since sunday night.2. Restore and Recovery: Copying files from backup taken sunday night and applying all the archivelog and redo log files to bring up the database to the point of failure. Here you dont loose the changes done until monday 11 am.Restore : copying files from the backup overwriting the existing database filesRecovery: applying the changes to the database till point of failure. these changes are recorded in online redolog and archivelog ( which are the backups of redolog) files.

In Microstrategy, how can you direct the sql generated to use a specifc table. I know of using ApplySimple, but there are other ways too...
If you need to use a specific table , we need to play with the logical size of that table. Whenever MSTR frames a query it retrieves data from the table that has the least logical size and hence when you set the logical size of your table to be least compared to the other base table, MSTR will retrieve data from this specified table.