Tag Archives: restore

Create and backup the Password File in a Disk Group of RAC Environment

Create and backup the Password File in a Disk Group of RAC Environment

ORAPWD supports the creation of password files on an Oracle ASM disk group.
All other password file manipulation is performed with ASMCMD or SRVCTL commands.

Manage password file

srvctl modify asm -pwfile location
srvctl modify database -db dbname -pwfile location
srvctl config asm

Creating a Password File in a Disk Group

orapwd file='+data/ORCL/orapwdb' dbuniquename='orcl'

For Creating ASM Password file Need to specify ASM.

orapwd file='+data/ASM/orapwasm' asm=y

Create password file from disk to diskgroup

orapwd input_file='/oraclegrid/dbs/orapwasm' file='+data/ASM/orapwasm' asm=y

Backing Up and Restoring an Oracle ASM Password File
Backup and restore is important if you lost the diskgroup then you can use another or restore that file from diskgroup password file

Backup steps for Password file

1. Get the location of Password file.

ASMCMD [+] > pwget --asm

2. Backup the password file to other diskgroup.

ASMCMD [+] > pwcopy +DATA/orapwasm +FRA/my_pwfile_backup

3. Verify the backup is created.

ASMCMD [+] > ls +fra/my_pwfile_backup

Restore Steps for password file

1. Two way to restore password file: Copy from anther diskgroup or change the location to new diskgroup.

-- Copy from anther diskgroup to old location diskgroup.
ASMCMD [+] > pwcopy --asm +FRA/my_pwfile_backup +DATA2/my_orapwasm

--change or set the location to new diskgroup.
ASMCMD [+] > pwset --asm +FRA/my_pwfile_backup

2. Verify the Password file location

ASMCMD [+] > pwget --asm

Refer from


Restore and Recover the tablespace with RMAN

Restore and Recover the tablespace with RMAN

Restore and recovery the tablespace with RMAN backup.

Following is method to restore and recovery tablespace without shutting down the complete database


Note: Take cold backup of completed database as precautions

1. Report the schema command to check datafiles and tablespace present

RMAN> Report schema;

2. Check alert log file for drop tablespace:
3. Offline the tablespace which having issue such as corruption/ datafiles lost
Suppose tablespace USERS having issue, we need to recover, taking offline the users tablespace:


4. Recover the tablespace:


5. Make it online to USERS


6. Check the status of tablespace present in database

select file_name,bytes from dba_data_files where tablespace_name='USERS';

ORA-01157: cannot identify/lock data file 4 – see DBWR trace file

ORA-01157: cannot identify/lock data file 4 – see DBWR trace file

ORA-01110: data file 5: ‘D:\ORACLE11204\ORADATA\PEGA\EXAMPLE01.DBF’

Error occurred due to DBWR process not able to lock the file for its use during startup of database.

SQL> alter database open;
alter database open
ERROR at line 1:
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: 'D:\ORACLE11204\ORADATA\PEGA\EXAMPLE01.DBF'

So, We need to check which process caused lock on the datafiles. if we did not found it may be corrupted we need to restore from backup.

SQL> alter database datafile 5 offline;
Database altered.

SQL> alter database open;
Database altered.

Recover and restore the datafile 5 though rman process:

RMAN> restore datafile 5;

Starting restore at 04-FEB-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to D:\ORACLE11204\ORADATA\PEGA\EXAMPLE01.DBF
channel ORA_DISK_1: reading from backup piece D:\BACKUP\FULL_DB_902883257_681P1
channel ORA_DISK_1: piece handle=D:\BACKUP\FULL_DB_902883257_681P1 tag=TAG20160204T005417
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 04-FEB-16

RMAN> recover datafile 5;
Starting recover at 04-FEB-16
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 04-FEB-16

Open the datafile in read and write mode.

RMAN> sql "alter database datafile 5 online";
sql statement: alter database datafile 5 online

Note: If you have downtime then do once clean shutdown and startup database
Take fresh backup of database after datafile 5 online.

Backup and Restore Database using RMAN Script

Backup and Restore Database with RMAN Scripts

RMAN is the utility provided by Oracle for taking backup at physical level.
For hot backup through RMAN you must be enabled archive log at database level.
Check it with archive log list; command in SQL PROMPT.


Backup the database with RMAN as follows:
1. Set the environment variable of Oracle

export ORACLE_HOME=/u01/oracle/dbhome_1

2. Connect with RMAN and execute the file which is in next step or save this line in bat file

#rman nocatalog target / cmdfile=/u01/rmanbackup/Fullbackup.rcv log=/u01/rmanbackup/Fullbackup.log

3. You can save the following script as Fullbackup.rcv in /u01/rmanbackup directory.
Backup database Scripts

run {
allocate channel ch00 type disk;
allocate channel ch01 type disk;
allocate channel ch02 type disk;
backup format '/rmanbackup/full_db_%t_%p%p' filesperset 10 database plus archivelog;
release channel ch00;
release channel ch01;
release channel ch02;
allocate channel ch00 type disk;
backup format '/rmanbackup/cntrl_%s_%p_%t' CURRENT CONTROLFILE;
Backup format '/rmanbackup/spfile_%s_%p_%t' spfile;
release channel ch00;

Restore the database from following script:

1. Bring the database in startup nomount.
Startup nomount;

2. Empty the oradata folder for completed restore.

3. Start the recover process as follows.

4. Specify the time up to which you want to recover the database otherwise it will upto last full backup.

5. Restore the control file from backup

allocate channel t1 type DISK;
set until time "to_date('2015/02/27 12:52:00','yyyy/mm/dd HH24:MI:SS')";
restore controlfile from 'scratch/rman_backup/cntrl_18_1_2384554';
release channel t1;

6. Bring the database at mount state

sqlplus / as sysdba
alter database mount;

7. Start the restore and recover process if you want database up to specific time then only need to give set until time

rman target /
run {
allocate channel t1 type DISK;
allocate channel t2 type DISK;
set until time "to_date('2015/02/27 12:52:00','yyyy/mm/dd HH24:MI:SS')";
restore database;
recover database;
release channel t1;
release channel t2;

8. Open the database in resetlogs:

sqlplus / as sysdba
alter database open resetlogs;

You can also use RMAN single script for restore as follows :

run {
allocate channel t1 type DISK;
set until time "to_date('2009/02/09 07:00:00','yyyy/mm/dd HH24:MI:SS')";
restore controlfile;
sql "alter database mount";
recover database;
sql "alter database open resetlogs";
release channel t1;