Sunday, October 9, 2011

Oracle RMAN -Simple commands

Recovery Manager :RMAN is a oracle utility used for backup and recovery purpose, following are simple commands to initiate with RMAN

connecting to RMAN
===========================

$ rman target sys/
If you’re accessing your target database remotely via Oracle Net, then you will need to
specify a connection string as follows:
$ rman target sys/@
You can also invoke RMAN and then connect to your target database as a second step,
from the RMAN prompt:
$ rman
RMAN> connect target /

Backing Up Your Database
===========================
You’re new to RMAN, and you want to back up your database. You just need to get a backup
created, and you want to take the simplest possible approach.
Solution
Start the rman utility, connect to your target database, and use the backup command to back up
your entire database:
$ rman target /
RMAN> backup database;


Simulating a Failure
================================
You want to simulate a failure as a prelude to testing RMAN’s restore and recovery capabilities.
Solution
To simulate a failure, perform the following steps:
1. Ensure you have a backup.
2. Determine the location and name of a datafile to rename. You will simulate failure by
renaming a datafile so that it appears to have been lost.
3. Stop the database.
4. Rename a datafile at the OS level (simulates media failure).
5. Attempt to start the database.

Before simulating a media failure, ensure that you’re in a noncritical test database environment
and that you have a good RMAN backup of your database. Run the following
command in your target database, and ensure that you have a good backup:
RMAN> connect target /
RMAN> list backup;

Caution If no backup information is listed, then stop here. You need to ensure that you have a good
backup of your database before you simulate media failure.
Determine the location of a target database datafile so that you can rename it to simulate
media failure:

RMAN> report schema;

Shown next is an abbreviated portion of the output of the previous command. This shows
the name of the file that you’re going to rename.

File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
4 22 USERS *** C:\ORA01\BRDSTN\USERS01.DBF

RMAN> shutdown immediate;
RMAN> exit

then rename the datafile to simulate

RMAN> connect target /
RMAN> startup

RMAN-03002: failure of startup command
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: 'C:\ORA01\BRDSTN\USERS01.DBF'



Restoring and Recovering Your Database
==========================================
You’ve experienced a failure and want to use RMAN to restore and recover your database. You
have a current and good backup in the default location, and all needed control files, archived
redo log files, and online redo log files are available.
Solution
Connect to RMAN, and use the following commands to restore and recover your database. In
this recipe you’ll perform the following steps:
1. Connect to the target database.
2. Mount the database.
3. Restore the database.
4. Recover the database.
5. Open the database.


RMAN> connect target /
RMAN> startup mount;
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open;
database opened

Thursday, June 23, 2011

Cloning oracle database using RMAN Duplicate-(ASM to ASM) steps:

Precloning activities:










Source database:



-parameter changes at source datbase-pfile-remote_login_passwordfile= exclusive



-make source database archive log enabled.



-change the sys password to known value and create the passwordfile



-Make sure, you are able to connect to source database from target server(remote connection)



-Keep source database in mount or open state.









Target database:









-create the password file. Password should be same as source############



-parameter remote_login_passwordfile= exclusive



-add foolowing paramters db_file_name_convert = ('+DG_source/oradata','+DG_target/oradata') ###### DATA DISKGROUP.



log_file_name_convert = ('+DG_source_DB_RC/oraredo','+DG_target_DB_RC/oraredo') ####### REDO CONTROL DISKGROUP









Cloning Activity:















Target database:









start the Database in nomount state









Start the Listener.















Check the rman connectting on the Target.



=============================================================



rman target sys/***@source_db









connect auxiliary sys/***@target_db









================================================================









rman_duplicate.sh ######### I kept the Parallelism as 32 only. May be we can increase to 100. It may put load on source server



=================



rman target sys/***@source_db auxiliary sys/***@target_db trace=debug.txt LOG duplicate_${ORACLE_SID}_${DATE}.log
run {

duplicate target database to target_DB FROM ACTIVE DATABASE;

}

exit

EOF



Intiate the Script

==================

nohup /oracle/admin//clone/rman_duplicate.sh > rman_duplicate.out 2>&1 &







Monitor the Log file

tail -f duplicate_target_DB_.log



It will take care of complete cloning.









Tuesday, May 10, 2011

Error while installing CRS ...

Error in cluvfy checks:


Check: User equivalence for user "oracle"
Node Name Comment
------------------------------------ ------------------------
node1 passed
node2 failed
Result: PRVF-4007 : User equivalence check failed for user "oracle"



Solution:
Check for the ssh trust between nodes.
There should not be any banner after ssh.
check the user equivalence as a oracle user

Tuesday, May 3, 2011

Oracle DBA Interview Questions ....

SET 1

1. How did oracle database evolve?
2. What is the sysaux and system tablespace?
3. how to find the free space for undotblspace? Hint----dba_undo_extents?
4. locally managed vs dictionary managed tablespaces?
5. what if redo group is lost? what if redo member is lost?
6. what is snapshot too old error? How recover from it?
7. what is fast_MTTR_target? Hint---mean time to recovery
8. How to get free,used,total tablespace sizes?
9. List out types of backup
10. how to take hot backup?
11. what is undo tablespace?
12. what if control file is lost?
13.what are kernal and os level parameter need to be set prior to installation of oracle?
13. what if backup is going on and if snapshot too old error is occuring
14. what are required export and import parameters?
15. What are mandatory background processes?





Set 2:
1.What happens when we kill smon or pmon?
2.How to recover database if UNDO gets corrupted?
3.What is a fractured block and how to fix it?
4.What is a corrupted block and how to fix it?
5.What are the oracle threads which start when we start the database?
6.How do we check a index is working properly and how do we decide a particular index has to rebuilt?
7.What steps do we need to take if we receive a call that performance has gone
down as a dba?
8.Is it possible to change block size after db creation?
9.If users are not able to connect database or database is down what preliminary steps are to be taken?
10.What does oracle do when we take hot backup where actually modified
blocks are written?
11. On what basis should RAM be determined for a 50gb database?
12.Can we connect a database using listener instead of tnsnames?
13.Normally what are the jobs a DBA has to do on a daily basis?
14. Can we create a physical standby database using hot backup?
15.Is there a limit for concurrent user connections in Oracle?
16.Can we increase user connections by using LISTENER FILE?