Tuesday 29 November 2011

Deleting a Database by using DBCA

Overview:
This article is a comprehensive guide for Deleting a Database by using DBCA.
Please do keep in mind that this article should not be considered a substitution of the official guide from Oracle (http://www.oracle.com).
Objective of the Article:
By the time we finish this article, we should be able to understand the following:
---How to delete a database by using DBCA?


 for complete screenshot of the steps please visit the below link:: http://www.sensehaze.com/mydata/resources_section/installation/del_db/index.php



Installation and creation of Database:
For Installation and creation of Database, please visit the below mentioned link:
Installation and creation of Database on windows





Deleting a database using DBCA:

Open command prompt and type "dbca"

Select the option "Delete a Database" and Click on "Next.

Select the Database we want to delete (here -- mydb) and enter the credentials:
username ---- sys
Password --- our_sys_password
and Click on "Finish",  



Click on "yes" to confirm. 

This finishes database deletion procedure.

for complete screenshot of the steps please visit the below link:: http://www.sensehaze.com/mydata/resources_section/installation/del_db/index.php

Saturday 26 November 2011

Restore RMAN full backup to different server with different directory structure

Restore RMAN full backup to different server with same database name but different directory structure::


In this article we are going to learn, how to restore RMAN full backup to a different server with same database name but different directory structure.



Overview:
This article is a comprehensive guide for restoring RMAN full backup to a different server with same database name but different directory structure.
Please do keep in mind that this article should not be considered a substitution of the official guide from Oracle (http://www.oracle.com). The below mentioned link can be used to download the official documentation for RMAN Recovery Techniques.
Names used in this article:
 Name  Value
 Database Name  mydb
 Backup Folder on Node1  c:\rman_bck
 Backup Folder on Node2  c:\rman_bck
 Database (Datafile/Controlfile/redolog) Folder on Node1  ORACLE_BASE\oradata\mydb
 Database (Datafile/Controlfile/redolog) Folder on Node2  ORACLE_BASE\oradata\mydbtest





 Connect to the database:

Open command prompt and type the below mentioned:
cmd> set ORACLE_SID=mydb
cmd> sqlplus / as sysdba
Create initialization parameter file (pfile).
sql>create pfile from spfile ;



Take Full Backup of Database using RMAN:
Open command prompt and type the below mentioned:
cmd> rman target /
We can configure the backup location (if not configured earlier). For configuring backup location type the following command:
RMAN> configure channel device type disk format 'C:\rman_bck\mydb_%U' ;


For taking backup of the database, fire the below mentioned command:
RMAN> backup database plus archivelog ;


  For the screenshots of the procedure please visit the link::: http://www.sensehaze.com


Copy the required files to the other node:
Copy the below mentioned files to the other node:
--The backup pieces generated using RMAN.
--The initalization parameter file( created above).
--The password file( We can create it also on the other node).


Create database directory structure on other node:
Create "oradata/mydbtest" directory on the other node ( for storing controlfiles,datafiles,redo logfiles ). Also create Archive Destination Directory.



Create Service/instance on other node:
Note:This step needs to be performed only on Windows O/S.
Create a service( Here in my case my datbase name -- mydb ).For creating service use "oradim" utility. As mentioned below:
cmd> oradim -new -sid mydb -intpwd sys -startmode manual

 After creating the service, change its startmode to automatic. For doing so go to "windows services" and change its startmode to automatic.


Edit PFILE on the other node:
Edit the PFILE and change the location of control_files/audit_file_dest as per the new directory structure on the other node.


Start the database in nomount mode on other node:
Open command prompt and type the below mentioned commands:
cmd> set ORACLE_SID=mydb
cmd> sqlplus / as sysdba
Start database with PFILE:
sql> startup nomount pfile='full_path_of_pfile' ;




Invoke RMAN on other node:
Open command prompt and type the below mentioned:
cmd> rman target /
Restore Controlfile:
Restore the controlfile from the backup pieces as mentioned below:
RMAN> restore controlfile from 'full_path_control_file_bck_piece' ;


Mount the Database:
After restoring the controlfile from the backuppieces mount the database :
RMAN> alter database mount ;

Rename the Redologfiles:
After mounting the database, Rename the Redologfiles,so that they can be created in new locations when the database is opened with resetlogs option, For renaming the redologs open a new command prompt and connect to the database from that prompt, as mentioned below:

On the second Node (Node2)
SQL> alter database rename file 'redo_file_loc_first_node\redo01.log' to 'redo_file_loc_second_node\redo01.log';
SQL> alter database rename file 'redo_file_loc_first_node\redo02.log' to 'redo_file_loc_second_node\redo02.log';
.....................
SQL> alter database rename file 'redo_file_loc_first_node\redoN.log' to 'redo_file_loc_second_node\redoN.log';

  For the screenshots of the procedure please visit the link::: http://www.sensehaze.com


Get the Datafile Info of Node 1:
Connect to the database of Node 1 and query the "DBA_DATA_FILES" for datafiles info, as mentioned below:
SQL> select file_id , file_name from dba_data_files ;


Restore and Recover the Database:
After collecting datafile information of Node 1, Now restore the datafiles to new locations and recover ( On Node2 ), as mentioned below:
RMAN> run {
set newname for datafile 1 to 'datafile_loc_node2\system01.dbf' ;
set newname for datafile 2 to 'datafile_loc_node2\sysaux01.dbf' ;
set newname for datafile 3 to 'datafile_loc_node2\undotbs01.dbf' ;
set newname for datafile 4 to 'datafile_loc_node2\user01.dbf' ;
set newname for datafile 5 to 'datafile_loc_node2\tools.dbf' ;
................ //mention all the datafiles

restore database ;
switch datafile all ;
recover database ;
}



If it show error ("media recovery requesting unknown archived log") that means, it requires the new archivelogs, copy the new archivelogs from node1 to node2 and rerurn the above command "recover database". (We can ignore this error).

Open the Database with Resetlogs:
After that, open the database with resetlogs options. As mentioned below:
RMAN> alter database open resetlogs;


Connect to the database & create spfile:
After that, Connect to the database and create spfile. As mentioned below:
cmd> sqlplus / as sysdba
SQL> create spfile from pfile='pfile_location';


This finishes restoring RMAN full backup to a different server with same database name but different directory structure.









Tuesday 22 November 2011

Restore RMAN full backup to different server with similar directory structure but changed backup location

Restore RMAN full backup to different server with same database name and similar directory structure but changed backup location:


In this article we are going to learn, how to restore RMAN full backup to a different server with same database name and similar directory structure but changed backup location.




 Overview:
This article is a comprehensive guide for restoring RMAN full backup to a different server with same database name and similar directory structure but changed backup location.
Please do keep in mind that this article should not be considered a substitution of the official guide from Oracle (http://www.oracle.com). The below mentioned link can be used to download the official documentation for RMAN Recovery Techniques.
Names used in this article:
 Name  Value
 Database Name  mydb
 Backup Folder on Node1  c:\rman_bck
 Backup Folder on Node2  c:\rman_bck1





Objective of the Article:
By the time we finish this article, we should be able to understand the following:
(1)How to take full backup of database using RMAN.
(2)How to restore RMAN full backup to different server with same database name and similar directory structure but changed backup location.




Connect to the database:
Open command prompt and type the below mentioned:
cmd> set ORACLE_SID=mydb
cmd> sqlplus / as sysdba
Create initialization parameter file (pfile).
sql>create pfile from spfile ;


 For all the screenshots visit the following link::: http://www.sensehaze.com


Take Full Backup of Database using RMAN:
Open command prompt and type the below mentioned:
cmd> rman target /
We can configure the backup location (if not configured earlier). For configuring backup location type the following command:
RMAN> configure channel device type disk format 'C:\rman_bck\mydb_%U' ;



For taking backup of the database, fire the below mentioned command:
RMAN> backup database plus archivelog ;



Copy the required files to the other node:
Copy the below mentioned files to the other node:
--The backup pieces generated using RMAN.
--The initalization parameter file( created above).
--The password file( We can create it also on the other node).


Create similar directory structure on other node:
Create "oradata/mydb" directory on the other node ( for storing controlfiles,datafiles,redo logfiles ). Also create Archive Destination Directory.



Create Service/instance on other node:
Note:This step needs to be performed only on Windows O/S.
Create a service( Here in my case my datbase name -- mydb ).For creating service use "oradim" utility. As mentioned below:
cmd> oradim -new -sid mydb -intpwd sys -startmode manual




Start the database in nomount mode on other node:
Open command prompt and type the below mentioned commands:
cmd> set ORACLE_SID=mydb
cmd> sqlplus / as sysdba
sql> startup nomount pfile='full_path_of_pfile' ;



 For all the screenshots visit the following link:::   http://www.sensehaze.com


 Invoke RMAN on other node:
Open command prompt and type the below mentioned:
cmd> rman target /

Restore Controlfile:
Restore the controlfile from the backup pieces as mentioned below:
RMAN> restore controlfile from 'full_path_control_file_bck_piece' ;

Mount the Database:
After restoring the controlfile from the backuppieces mount the database :
RMAN> alter database mount ;

Crosscheck Backup:
After mounting the database, crosscheck the bakcup, as mentioned below:
RMAN> crosscheck backup ;

Delete Expired Backups:
After running crosscheck, run "delete noprompt expired", as mentioned below:
Note : Be sure we really moved the backup files in the other location, otherwise after entering "delete noprompt expired", these files are lost and we will not able to execute a full restore.
RMAN> delete noprompt expired backup ;

Catalog the Backuppieces:
After running "delete noprompt expired", catalog all the backuppieces, as mentioned below:
RMAN> catalog backuppiece 'full_path_bck_piece_1' ;
RMAN> catalog backuppiece 'full_path_bck_piece_2' ;
RMAN> catalog backuppiece 'full_path_bck_piece_3' ;
RMAN> catalog backuppiece 'full_path_bck_piece_n' ;

Restore Database:
After catalogging all the backuppieces, run restore database command, as mentioned below:
RMAN> restore database ;

Recover Database:
After restoring the database, recover it as mentioned below:
RMAN> recover database ;

If it show error ("media recovery requesting unknown archived log") that means, it requires the new archivelogs, copy the new archivelogs from node1 to node2 and rerurn the above command "recover database". (We can ignore this error).
Open the Database with Resetlogs:
After that, open the database with resetlogs options. As mentioned below:
RMAN> alter database open resetlogs;


Connect to the database & create spfile:
After that, Connect to the database and create spfile. As mentioned below:
cmd> sqlplus / as sysdba
SQL> create spfile from pfile='pfile_location';

This finishes restoring RMAN full backup to a different server with same database name and similar directory structure but changed backup location.
 For all the screenshots visit the following link   :::  http://www.sensehaze.com














Friday 18 November 2011

Restore RMAN full backup to different server with same database name and similar directory structure

In this article we are going to learn, how to restore RMAN full backup to a different server with same database name and similar directory structure.


Overview:
This article is a comprehensive guide for restoring RMAN full backup to a different server with same database name and similar directory structure.
Please do keep in mind that this article should not be considered a substitution of the official guide from Oracle (http://www.oracle.com). The below mentioned link can be used to download the official documentation for RMAN Recovery Techniques.
Names used in this article:
 Name  Value
 Database Name  mydb
 Backup Folder  c:\rman_bck



Connect to the database:
Open command prompt and type the below mentioned:
cmd> set ORACLE_SID=mydb
cmd> sqlplus / as sysdba
Create initialization parameter file (pfile).
sql>create pfile from spfile ;




Take Full Backup of Database using RMAN:
Open command prompt and type the below mentioned:
cmd> rman target /
We can configure the backup location (if not configured earlier). For configuring backup location type the following command:
RMAN> configure channel device type disk format 'C:\rman_bck\mydb_%U' ;

For taking backup of the database, fire the below mentioned command:
RMAN> backup database plus archivelog ;

The above activity will take some time, depending upon the database size.
For the complete screenshot of the activities plesae visit the followong link::: http://www.sensehaze.com/
Copy the required files to the other node:
Note:Make sure all rman backup files from Node1 are in the same location(s) in the new server(Node2) as the source server(Node1) (same path names and directory structure ).
Copy the below mentioned files to the other node:
--The backup pieces generated using RMAN.
--The insitalization parameter file( created above).
--The password file( We can create it also on the other node).




Create similar directory structure on other node:
Create "oradata/mydb" directory on the other node ( for storing controlfiles,datafiles,redo logfiles ). Also create Archive Destination Directory.


 For the complete screenshot of the activities plesae visit the followong link::: http://www.sensehaze.com/

Create Service/instance on other node:
Note:This step needs to be performed only on Windows O/S.
Create a service( Here in my case my datbase name -- mydb ).For creating service use "oradim" utility. As mentioned below:
cmd> oradim -new -sid mydb -intpwd sys -startmode manual

After creating the service, change its startmode to automatic. For doing so go to "windows services" and change its properties.  




Start the database in nomount mode on other node:
Open command prompt and type the below mentioned:
cmd> set ORACLE_SID=mydb
cmd> sqlplus / as sysdba
sql> startup nomount pfile='full_path_of_pfile' ;


 For the complete screenshot of the activities plesae visit the followong link::: http://www.sensehaze.com/


Invoke Rman on other node:
Open command prompt and type the below mentioned:
cmd> rman target /
Restore the controlfile from the backup pieces as mentioned below:
RMAN> restore controlfile from 'full_path_control_file_bck_piece' ;

After restoring the controlfile from the backup pieces mount the database :
RMAN> alter database mount ;


After mounting the database, restore it as mentioned below:
RMAN> restore database ;

After restoring the database, recover it as mentioned below:
RMAN> recover database ;


If it show error ("media recovery requesting unknown archived log") that means, it requires the new archivelogs ,copy the new archivelogs from node1 to node2.
We can ignore the error.
For not encountering this error we can use "until" option with the above command.

After that, open the database with resetlogs options. As mentioned below:
RMAN> alter database open resetlogs;



After that, Connect to the database and create spfile. As mentioned below:
cmd> sqlplus / as sysdba
SQL> create spfile from pfile='pfile_location';


For the complete screenshot of the activities plesae visit the followong link::: http://www.sensehaze.com/