Monday, July 21, 2014

OCR backup and recovery

OCR calls Oracle Cluster Registry. It stores cluster configuration information.
It is also shared disk component. It must be accessed by all nodes in cluster environment.
It also keeps information of Which database instance run on which nodes and which service runs on which database.The process daemon OCSSd manages the configuration info in OCR and maintains the changes to cluster in the registry.

Automatic backup of OCR is done by CRSD process and every 3 hours.
Default location is CRS_home/cdata/cluster_name. But we can change default location of this backup of OCR.
We can check default location using following command.

$ocrconfig -showbackup

We can change this default location of physical OCR copies using following command.
$ocrconfig -backuploc

We can take export backup of OCR (Oracle Cluster Registry) also in online. but this is only possible if we are using more than 1 OCR files .

ocrconfig -export backup location
We can restore OCR via import command but for that we need to stop cluster .
ocrconfig -import

Oracle takes physical backup of OCR automatically.
No Cluster downtime or RAC database down time requires for PHYSICAL backup of OCR.
No Cluster downtime or RAC database down time requires for MANUAL export backup of OCR.
For recovery of OCR from any of above backup it should need to down ALL.

All procedure requires ROOT login.

Sunday, July 20, 2014

Oracle 11G cluster logfile location

CRS_HOME/log/hostname/crsd/ – The log files for the CRS daemon
CRS_HOME/log/hostname/cssd/ – The log files for the CSS daemon
CRS_HOME/log/hostname/evmd/ – The log files for the EVM daemon
CRS_HOME/log/hostname/client/ – The log files for the Oracle Cluster Registry (OCR)
CRS_HOME/log/hostname/racg/ – The log files for the Oracle RAC high availability component
CRS_HOME/log/hostname/racg – The log files for the Oracle RAC high availability component
CRS_HOME/log/hostanme/alert.log – The alert.log for Clusterware issues.

Convert Non Rac db to RAC DB in 11G

logging in sys user

1-sql >@?/rdbms/admin/catclust.sql   

2-Create undo tablespaces and redo log threads for other instances and enable the newly created threads

joshi1 >CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE '+DATA' size 2048M;

Tablespace created

3-joshi1 >alter database add logfile thread 2 group 8 ('+DATA','+DATA') SIZE 105m;

Database altered.

4-joshi1 >alter database add logfile thread 2 group 9 ('+DATA','+DATA') SIZE 105m;

Database altered.

5-joshi1 >alter database enable public thread 2;

Database altered.
6-Shutdown the  instance and add below  RAC parameters to parameter file.

*.cluster_database = TRUE
*.cluster_database_instances = 2
*.undo_management=AUTO
joshi1.undo_tablespace=UNDOTBS
joshi1.instance_name=joshi1
joshi1.instance_number=1
joshi1.thread=1
joshi2.instance_name=joshi2
joshi2.instance_number=2
joshi2.thread=2
joshi2.undo_tablespace=UNDOTBS2
instance_number=2

7-Create  spfile from pfile

joshi1 >create spfile='+DATA' from pfile;

File created.

Start Database using spfile , for spfile location go into asm >'+DATA' >db_unique_name>parameterfile>spfile****

add spfile complete location in pfile and restart database and validate  new spfile location

logging into node 2 and create audit and dignostic dump location .
source instance 2 enviornment file .
add new spfile location into pfile inside $ORACLE_HOME/dbs.


8-Register the all RAC instances and database with crs

srvctl add database -d joshi -o /prod/product/oracle/product/11.2.0.2
srvctl add instance -i joshi1 -d joshi -n Rac1

srvctl add instance -i joshi2 -d joshi -n Rac2

9-Start all instances using srvctl

Rac1[oracle]_joshi1> srvctl start database -d joshi

Rac1[oracle]_joshi1> srvctl status database -d joshi
Instance joshi1 is running on node Rac1
Instance joshi2 is running on node Rac2

10-Configure local  RAC listener using netca

11.    Set  the local listener and remote listener parameters for all instance.

a.    For remote listener parameter ,please specify the scan hostname and scan port number
b.    For local listener, Please virtual IP address as hostname and local listener port number .

alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXXX-VIP)(PORT=1629))))' scope=both sid='joshi1';
alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXXX-VIP)(PORT=1629))))' scope=both sid='joshi2';
alter system set remote_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXX_SCAN)(PORT=1628))))' scope=both sid='*';

Manual database creation in oracle 11g

Manual Database creation steps as below.
1-Create environment files on all nodes for all instances..
(target instance name will be normally <sourceinstance_name>n,where n=1,2,.. Node of nodes)

oracle@Rac1[joshi1]> echo $ORACLE_SID
joshi1
oracle@Rac1[joshi1]> echo $ORACLE_HOME
/prod/product/oracle/11.2.0


2- a- Verify exist RAC recource detail.
        crs_stat -t
       
Rac1[oracle]_+ASM1> crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.ARCH.dg    ora....up.type ONLINE    ONLINE    host...b020
ora.DATA.dg    ora....up.type ONLINE    ONLINE    host...b020
ora....ER.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....N1.lsnr ora....er.type ONLINE    ONLINE    host...b021
ora....N2.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....N3.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....C1.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....VOTE.dg ora....up.type ONLINE    ONLINE    host...b020
ora.asm        ora.asm.type   ONLINE    ONLINE    host...b020
ora....SM1.asm application    ONLINE    ONLINE    host...b020
ora....20.lsnr application    ONLINE    ONLINE    host...b020
ora....20.lsnr application    ONLINE    ONLINE    host...b020
ora....020.gsd application    OFFLINE   OFFLINE
ora....020.ons application    ONLINE    ONLINE    host...b020
ora....020.vip ora....t1.type ONLINE    ONLINE    host...b020
ora....SM2.asm application    ONLINE    ONLINE    host...b021
ora....21.lsnr application    ONLINE    ONLINE    host...b021
ora....21.lsnr application    ONLINE    ONLINE    host...b021
ora....021.gsd application    OFFLINE   OFFLINE
ora....021.ons application    ONLINE    ONLINE    host...b021
ora....021.vip ora....t1.type ONLINE    ONLINE    host...b021
ora.cvu        ora.cvu.type   ONLINE    ONLINE    host...b020
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE
ora....network ora....rk.type ONLINE    ONLINE    host...b020
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    host...b020
ora.ons        ora.ons.type   ONLINE    ONLINE    host...b020
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    host...b021
ora.scan2.vip  ora....ip.type ONLINE    ONLINE    host...b020
ora.scan3.vip  ora....ip.type ONLINE    ONLINE    host...b020
ora....arc1.db ora....se.type ONLINE    ONLINE    host...b020
       
   b- check the avilable node name for this cluster.
      olsnodes -n -i -s
   
Rac1[oracle]_+ASM1> olsnodes -n -i -s
Rac1    1       Rac1-vip        Active
Rac2    2       Rac2-vip        Active
   
3-Verify and make sure we are entho space on asm diskgroup.
Rac1[oracle]_+ASM1> asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     65542    65275                0           65275              0             N  ARCH/
MOUNTED  EXTERN  N         512   4096  1048576    131084    80266                0           80266              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     17408    17012                0           17012              0             Y  OCR_VOTE/


4-Create the directories specified in environment file on all nodes and for diagnostic_dest and audit_file_dest

5-Set environment to target instance on primary node -- from here we are going to start creating DB.

6-Copy the pfile from  anyof db to the  node, and update value for below database. 
 -Initialization parameter file
db_block_size=8192
cluster_database_instances=2
open_cursors=300
db_name=joshi
db_create_file_dest=+DATA
db_recovery_file_dest_size=2147483648
diagnostic_dest=/data01/app/oracle
processes=500
sga_target=3G
audit_file_dest=/data01/app/oracle/admin/joshi/adump
audit_trail=db
pga_aggregate_target=100M
undo_tablespace=UNDOTBS1
log_archive_dest=+ARCH
db_unique_name=joshi
--Need to change below parameter as per Env.
---diagnostic_dest=---
--audit_file_dest=---
--control_files=+DATA,+DATA 
---log_archive_dest=+ARCH
---db_create_file_dest='+DATA'
-----Above db_unique_name is Very importemnet parameter ASM will create file inside root of data Diskgroup , Carefully setup this parametere value .
7-Start the instance to nomount state
oracle@Rac1[joshi1]> sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 20 13:50:28 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.


SQL*Plus tells us that connected to an idle instance. That means that it is not yet started.
So, lets start the instance. .
SQL> startup nomount
ORACLE instance started.

Total System Global Area 3206836224 bytes
Fixed Size                  2232640 bytes
Variable Size             654315200 bytes
Database Buffers         2499805184 bytes
Redo Buffers               50483200 bytes


CREATE DATABASE joshi
MAXINSTANCES 32
MAXLOGHISTORY 1
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE SIZE 300M AUTOEXTEND ON NEXT  1024M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE SIZE 120M AUTOEXTEND ON NEXT  1024M MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE SIZE 20M AUTOEXTEND ON NEXT  640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE SIZE 200M AUTOEXTEND ON NEXT  5120K MAXSIZE UNLIMITED
DEFAULT TABLESPACE USERS DATAFILE SIZE 100M
CHARACTER SET UTF8
LOGFILE GROUP 1  SIZE 500M,
GROUP 2  SIZE 500M

 -- If something goes wrong with the creation, Oracle will write an error into the alert log.
8. Adding  CONTROL_FILES location in pfile.

set linesize 2048;
column ctl_files NEW_VALUE ctl_files;
select concat('control_files=''', concat(replace(value, ', ', ''','''), '''')) ctl_files from v$parameter where name ='control_files';

control_files='+DATA/joshi/controlfile/current.302.853422869'



Now lets run below script for creating data dictnery tables.

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catblock.sql
@?/rdbms/admin/catproc.sql

 Run following script as SYSTEM user.

connect system/manager
@?/sqlplus/admin/pupbld.sql
@?/sqlplus/admin/help/hlpbld.sql helpus.sql

!wow here we created DB on ASM file system .

Here we are going to convert db on RAC

logging in sys user

1-sql >@?/rdbms/admin/catclust.sql   

2-Create undo tablespaces and redo log threads for other instances and enable the newly created threads

joshi1 >CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE '+DATA' size 2048M;

Tablespace created

3-joshi1 >alter database add logfile thread 2 group 8 ('+DATA','+DATA') SIZE 105m;

Database altered.

4-joshi1 >alter database add logfile thread 2 group 9 ('+DATA','+DATA') SIZE 105m;

Database altered.

5-joshi1 >alter database enable public thread 2;

Database altered.
6-Shutdown the  instance and add below  RAC parameters to parameter file.

*.cluster_database = TRUE
*.cluster_database_instances = 2
*.undo_management=AUTO
joshi1.undo_tablespace=UNDOTBS
joshi1.instance_name=joshi1
joshi1.instance_number=1
joshi1.thread=1
joshi2.instance_name=joshi2
joshi2.instance_number=2
joshi2.thread=2
joshi2.undo_tablespace=UNDOTBS2
instance_number=2

7-Create  spfile from pfile

joshi1 >create spfile='+DATA' from pfile;

File created.

Start Database using spfile , for spfile location go into asm >'+DATA' >db_unique_name>parameterfile>spfile****

add spfile complete location in pfile and restart database and validate  new spfile location

logging into node 2 and create audit and dignostic dump location .
source instance 2 enviornment file .
add new spfile location into pfile inside $ORACLE_HOME/dbs.


8-Register the all RAC instances and database with crs

srvctl add database -d joshi -o /prod/product/oracle/product/11.2.0.2
srvctl add instance -i joshi1 -d joshi -n Rac1

srvctl add instance -i joshi2 -d joshi -n Rac2

9-Start all instances using srvctl

Rac1[oracle]_joshi1> srvctl start database -d joshi

Rac1[oracle]_joshi1> srvctl status database -d joshi
Instance joshi1 is running on node Rac1
Instance joshi2 is running on node Rac2

10-Configure local  RAC listener using netca

11.    Set  the local listener and remote listener parameters for all instance.

a.    For remote listener parameter ,please specify the scan hostname and scan port number
b.    For local listener, Please virtual IP address as hostname and local listener port number .

alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXXX-VIP)(PORT=1629))))' scope=both sid='joshi1';
alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXXX-VIP)(PORT=1629))))' scope=both sid='joshi2';
alter system set remote_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXX_SCAN)(PORT=1628))))' scope=both sid='*';

Manual Database creation in ASM file system

Manual Database creation steps as below.

1-Create environment files on all nodes for all instances..
(target instance name will be normally <sourceinstance_name>n,where n=1,2,.. Node of nodes)

oracle@Rac1[joshi1]> echo $ORACLE_SID
joshi1
oracle@Rac1[joshi1]> echo $ORACLE_HOME
/prod/product/oracle/11.2.0


2- a- Verify exist RAC recource detail.
        crs_stat -t
      
Rac1[oracle]_+ASM1> crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.ARCH.dg    ora....up.type ONLINE    ONLINE    host...b020
ora.DATA.dg    ora....up.type ONLINE    ONLINE    host...b020
ora....ER.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....N1.lsnr ora....er.type ONLINE    ONLINE    host...b021
ora....N2.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....N3.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....C1.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....VOTE.dg ora....up.type ONLINE    ONLINE    host...b020
ora.asm        ora.asm.type   ONLINE    ONLINE    host...b020
ora....SM1.asm application    ONLINE    ONLINE    host...b020
ora....20.lsnr application    ONLINE    ONLINE    host...b020
ora....20.lsnr application    ONLINE    ONLINE    host...b020
ora....020.gsd application    OFFLINE   OFFLINE
ora....020.ons application    ONLINE    ONLINE    host...b020
ora....020.vip ora....t1.type ONLINE    ONLINE    host...b020
ora....SM2.asm application    ONLINE    ONLINE    host...b021
ora....21.lsnr application    ONLINE    ONLINE    host...b021
ora....21.lsnr application    ONLINE    ONLINE    host...b021
ora....021.gsd application    OFFLINE   OFFLINE
ora....021.ons application    ONLINE    ONLINE    host...b021
ora....021.vip ora....t1.type ONLINE    ONLINE    host...b021
ora.cvu        ora.cvu.type   ONLINE    ONLINE    host...b020
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE
ora....network ora....rk.type ONLINE    ONLINE    host...b020
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    host...b020
ora.ons        ora.ons.type   ONLINE    ONLINE    host...b020
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    host...b021
ora.scan2.vip  ora....ip.type ONLINE    ONLINE    host...b020
ora.scan3.vip  ora....ip.type ONLINE    ONLINE    host...b020
ora....arc1.db ora....se.type ONLINE    ONLINE    host...b020
       
   b- check the avilable node name for this cluster.
      olsnodes -n -i -s
   
Rac1[oracle]_+ASM1> olsnodes -n -i -s
Rac1    1       Rac1-vip        Active
Rac2    2       Rac2-vip        Active
   
3-Verify and make sure we are entho space on asm diskgroup.
Rac1[oracle]_+ASM1> asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     65542    65275                0           65275              0             N  ARCH/
MOUNTED  EXTERN  N         512   4096  1048576    131084    80266                0           80266              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     17408    17012                0           17012              0             Y  OCR_VOTE/


4-Create the directories specified in environment file on all nodes and for diagnostic_dest and audit_file_dest

5-Set environment to target instance on primary node -- from here we are going to start creating DB.

6-Copy the pfile from  anyof db to the  node, and update value for below database. 
 -Initialization parameter file
db_block_size=8192
cluster_database_instances=2
open_cursors=300
db_name=joshi
db_create_file_dest=+DATA
db_recovery_file_dest_size=2147483648
diagnostic_dest=/data01/app/oracle
processes=500
sga_target=3G
audit_file_dest=/data01/app/oracle/admin/joshi/adump
audit_trail=db
pga_aggregate_target=100M
undo_tablespace=UNDOTBS1
log_archive_dest=+ARCH
db_unique_name=joshi
--Need to change below parameter as per Env.
---diagnostic_dest=---
--audit_file_dest=---
--control_files=+DATA,+DATA 
---log_archive_dest=+ARCH
---db_create_file_dest='+DATA'
-----Above db_unique_name is Very importemnet parameter ASM will create file inside root of data Diskgroup , Carefully setup this parametere value .
7-Start the instance to nomount state
oracle@Rac1[joshi1]> sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 20 13:50:28 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.


SQL*Plus tells us that connected to an idle instance. That means that it is not yet started.
So, lets start the instance. .
SQL> startup nomount
ORACLE instance started.

Total System Global Area 3206836224 bytes
Fixed Size                  2232640 bytes
Variable Size             654315200 bytes
Database Buffers         2499805184 bytes
Redo Buffers               50483200 bytes


CREATE DATABASE joshi
MAXINSTANCES 32
MAXLOGHISTORY 1
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE SIZE 300M AUTOEXTEND ON NEXT  1024M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE SIZE 120M AUTOEXTEND ON NEXT  1024M MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE SIZE 20M AUTOEXTEND ON NEXT  640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE SIZE 200M AUTOEXTEND ON NEXT  5120K MAXSIZE UNLIMITED
DEFAULT TABLESPACE USERS DATAFILE SIZE 100M
CHARACTER SET UTF8
LOGFILE GROUP 1  SIZE 500M,
GROUP 2  SIZE 500M

 -- If something goes wrong with the creation, Oracle will write an error into the alert log.
8. Adding  CONTROL_FILES location in pfile.

set linesize 2048;
column ctl_files NEW_VALUE ctl_files;
select concat('control_files=''', concat(replace(value, ', ', ''','''), '''')) ctl_files from v$parameter where name ='control_files';
control_files='+DATA/joshi/controlfile/current.302.853422869'

9-Now lets run below script for creating data dictnery tables.

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catblock.sql
@?/rdbms/admin/catproc.sql

 Run following script as SYSTEM user.

connect system/manager
@?/sqlplus/admin/pupbld.sql
@?/sqlplus/admin/help/hlpbld.sql helpus.sql

!wow here we created DB on ASM file system .

Saturday, July 19, 2014

11G RAC Commands

11G RAC Commands

Commands                                         Function 

crs_stat:                                           Displays CRS resource status
crsctl check crs                                  Check CRS status
crsctl stop  crs                                  Stops the CRS and all services
crsctl stop resource ora.crsd             Stop resource
crsctl start resource ora.crsd             Start resource
crsctl stop cluster -all                        Stop all cluster
crsctl start cluster -all                        Start all cluster
crsctl check cluster -all                     Check all cluster
crsctl disable crs*                         Prevents CRS from autostarting on server bounce
crsctl enable crs*                         Enables CRS autostart on reboot
crs_stop all                                Stops all registered CRS resources
crs_start all                                Starts all registered resources
srvctl status scan                             SCAN STATUS
ocrcheck                                        To check ocr file
olsnodes -n -p -i                             nodes in the cluster

srvctl stop diskgroup -g data
srvctl stop diskgroup -g backup==Stop diskgroups and ASM instance
srvctl stop asm
srvctl -                                             srvctl help
crvctl -h                                           crsctl help

OPTION                         MEANING
-d                                    Database name
-h                                    Print Usage
-i                                     Comma-separated list of instance names
-n                                     Node names or comma-separated node list
-o                               $ORACLE_HOME to locate lsnrctl (node option) and oracle binaries (other options)
-c                                  Connect string for connecting to the Oracle instance using SQL*Plus
-s                                  servicename


Friday, July 18, 2014

RMAN Commands List

RMAN Commands List

--To Connect in rman tool
rman target/
[oracle@]$ rman target/

Recovery Manager: Release 10.2.0.4.0 - Production on Sat Jul 19 01:20:04 2014

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: CRMPRD (DBID=382866142)

-- Check the RMAN configuration
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/product/10.2.0/db_1/dbs/snapcf_sync.f'; # default

--To check backup detail  :
RMAN> list backup;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11      Full    163.90M    DISK        00:00:28     07-JUL-14    
        BP Key: 11   Status: AVAILABLE  Compressed: NO  Tag: TAG20140707T003026
        Piece Name: /shared/sync/backup/07july/0epcokp2_1_1.bkp
  List of Datafiles in backup set 11
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 716451     07-JUL-14 /shared/sync/data/undo01.dbf
  7       Full 716451     07-JUL-14 /shared/sync/data/system04.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12      Full    290.83M    DISK        00:00:32     07-JUL-14    
        BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: TAG20140707T003026
        Piece Name: /shared/sync/backup/07july/0dpcokp2_1_1.bkp

RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
11      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
12      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
13      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
14      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
15      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
16      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
17      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T004125
18      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
19      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
20      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
21      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
22      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
23      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
24      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T115629
25      B  F  A DISK        14-JUL-14       1       1       NO         TAG20140714T021344
26      B  F  A DISK        18-JUL-14       1       1       NO         TAG20140718T091235

-- To check datafile details via rman
RMAN> report schema;

Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    325      SYSTEM               ***     /shared/sync/data/system01.dbf
2    200      UNDOTBS              ***     /shared/sync/data/undo01.dbf
3    400      SYSAUX               ***     /shared/sync/data/sysaux01.dbf
4    200      TBS_1                ***     /shared/sync/data/users.dbf
5    4096     USERS                ***     /shared/sync/data/users01.dbf
6    4096     USERS                ***     /shared/sync/data/users02.dbf
7    500      SYSTEM               ***     /shared/sync/data/system04.dbf
8    2048     TMP                  ***     /shared/sync/data/tmp.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMPTS1              20          /shared/sync/data/temp_tbs.dbf
2    1024     TEMP                 1024        /shared/sync/data/temp01.dbf

Retention poilcy command
For all your daily backups maintain a normal retention policy i.e
Rman > configure retention policy for recovery window of 35 days

--- Taking full db backup if db is no archive mode please run it from mount state.
Backup Commands

run
{
allocate channel d1 device type disk format '/shared/sync/backup/07july/%U.bkp';
allocate channel d2 device type disk format '/shared/sync/backup/07july/%U.bkp';
allocate channel d3 device type disk format '/shared/sync/backup/07july/%U.bkp';
allocate channel d4 device type disk format '/shared/sync/backup/07july/%U.bkp';
BACKUP DATABASE ;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
}
--By default rman will not take arch file and control file backup . in using below signal command we can take all 3 file backup
RMAN> backup database include current controlfile plus archive log;
The above command backs up the target database and the current control file and archive log files
--- Controlfile backup
RMAN> BACKUP CURRENT CONTROLFILE;
-- Here we are going to take  INCREMENTAL LEVEL 0 and 1 backup . by default rman will take  differential backup.we can take this type backup if db is archive log mode only .
RMAN> BACKUP INCREMENTAL LEVEL=0 DATABASE;
RMAN> BACKUP INCREMENTAL LEVEL=1 DATABASE;

-- The below command verifies all file available if any backup file is not available it will make  as unavailable.
RMAN> crosscheck backup;

Recover and restore commands.
RMAN> restore database;
RMAN> recover database

Delete arch file which was created 1 hours before .

DELETE ARCHIVELOG ALL COMPLETED BEFORE "SYSDATE-1/24";

How to create user in MY SQL

Create  a new MySQL user Account mysql > CREATE USER ' newuser '@'localhost' IDENTIFIED BY ' password '...