Search This Blog

Total Pageviews

Friday 27 January 2017

How to Convert Database from Standard to Enterprise Edition



Oracle Standard Edition to the Enterprise Edition ...



Following are the steps required to upgrade from Standard Edition database to Enterprise Edition:


#oraeed:/u01/app/oracle/product/11.2.0/dbhome_3:N  Old Home for Standard Edition

oraeed:/u01/app/oracle/product/11.2.4/db_1  new home for Enterprise Edition


steps to upgrade a Standard Edition database to Enterprise Edition on 11gr2:

1. Install new Home for Enterprise Edition 

2. Take database  backup  !!!!!!!!!!!!!!!!!!!!

3. copy spfile from old home to new home 

 cd /u01/app/oracle/product/11.2.0/dbhome_3/dbs/
 ls -ltr
 cp spfileoraeed.ora  /u01/app/oracle/product/11.2.4/db_1/dbs/


edit this file /etc/oratab

from 
#oraeed:/u01/app/oracle/product/11.2.0/dbhome_3:N
to 
oraeed:/u01/app/oracle/product/11.2.4/db_1

. oraenv for new home

4) Startup database with new home

sqlplu> startup upgrade ;

5. 
sqlplus>
spool /tmp/upgrade.log
@?/rdbms/admin/catupgrd.sql


@?/rdbms/admin/catproc.sql

check invalid objects 

SQL> SELECT count(*) FROM dba_invalid_objects;

  COUNT(*)
----------
       420


SQL> @?/rdbms/admin/utlrp.sql



PL/SQL procedure successfully completed.


Function dropped.


PL/SQL procedure successfully completed.

SQL> SELECT count(*) FROM dba_invalid_objects;

  COUNT(*)
----------
         0

SELECT distinct object_name FROM dba_invalid_objects;


SQL>  select version from v$timezone_file;

   VERSION
----------
        11

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

  
set linesize 200
COL PRODUCT FORMAT A45
COL VERSION FORMAT A15
COL STATUS FORMAT A25 
SELECT * FROM PRODUCT_COMPONENT_VERSION ;

PRODUCT                                       VERSION         STATUS
--------------------------------------------- --------------- -------------------
NLSRTL                                        11.2.0.4.0      Production
Oracle Database 11g Enterprise Edition        11.2.0.4.0      64bit Production
PL/SQL                                        11.2.0.4.0      Production
TNS for Linux:                                11.2.0.4.0      Production


SQL> SQL> SQL> def
DEFINE _DATE           = "27-JAN-17" (CHAR)
DEFINE _CONNECT_IDENTIFIER = "oraeed" (CHAR)
DEFINE _USER           = "SYS" (CHAR)
DEFINE _PRIVILEGE      = "AS SYSDBA" (CHAR)
DEFINE _SQLPLUS_RELEASE = "1102000400" (CHAR)
DEFINE _EDITOR         = "ed" (CHAR)
DEFINE _O_VERSION      = "Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production  !!!!!!!!!!!!!!!!



If required .. 

SQL>  exec DBMS_REGISTRY_SYS.VALIDATE_CATPROC;

PL/SQL procedure successfully completed.




PRODUCT                                       VERSION         STATUS
--------------------------------------------- --------------- -------------------------
NLSRTL                                        11.2.0.4.0      Production
Oracle Database 11g Enterprise Edition        11.2.0.4.0      64bit Production
PL/SQL                                        11.2.0.4.0      Production
TNS for Linux:                                11.2.0.4.0      Production


set pagesize 200
SELECT comp_id, version, status FROM dba_registry

COMP_ID                        VERSION         STATUS
------------------------------ --------------- -------------------------
OWB                            11.2.0.1.0      VALID
APEX                           3.2.1.00.10     VALID
EM                             11.2.0.4.0      VALID
AMD                            11.2.0.4.0      VALID
SDO                            11.2.0.4.0      VALID
ORDIM                          11.2.0.4.0      VALID
XDB                            11.2.0.4.0      VALID
CONTEXT                        11.2.0.4.0      VALID
EXF                            11.2.0.4.0      VALID
RUL                            11.2.0.4.0      VALID
OWM                            11.2.0.4.0      VALID
CATALOG                        11.2.0.4.0      VALID
CATPROC                        11.2.0.4.0      VALID
JAVAVM                         11.2.0.4.0      VALID
XML                            11.2.0.4.0      VALID
CATJAVA                        11.2.0.4.0      VALID
APS                            11.2.0.4.0      VALID
XOQ                            11.2.0.4.0      VALID

18 rows selected.

Saturday 21 January 2017

Refresh Standby in Standard edition .. ..



 Refresh Standby in standard edition .. ..



on standby database in standard edition 
Refresh Standby Database From The Primary Database Using RMAN Incremental Backup

standby database in standard edition 

Oracle version 

Oracle Database 11g Release 11.2.0.1.0 - 64bit Production


On standby !!!!!!!!!!!!!


SQL> recover managed standby database disconnect;


SQL> 
select INST_ID, min(fhscn), min(FHRBA_SEQ) from x$kcvfh
group by inst_id;

   INST_ID MIN(FHSCN)       MIN(FHRBA_SEQ)
---------- ---------------- --------------
         1 960237                       15

SQL> 

break on INST_ID
set pages 1000 lines 150
COL GROUP#    for a15
col status    for a20
select INST_ID,PROCESS,STATUS,SEQUENCE#,THREAD#,GROUP#,PID from GV$MANAGED_STANDBY
order by INST_ID,STATUS;

   INST_ID PROCESS   STATUS                SEQUENCE#    THREAD# GROUP#                 PID
---------- --------- -------------------- ---------- ---------- --------------- ----------
         1 ARCH      CONNECTED                     0          0 N/A                   4126
           ARCH      CONNECTED                     0          0 N/A                   4128
           ARCH      CONNECTED                     0          0 N/A                   4130
           ARCH      CONNECTED                     0          0 N/A                   4132
           MRP0      WAIT_FOR_GAP                 15          1 N/A                   4431 <<<<<<<<<<---- archive log sequence 



SQL> SQL> select MIN(scn) Min_Scn from (SELECT to_char(CURRENT_SCN) scn FROM V$DATABASE
  2                                union
  3                                select to_char(min(fhscn)) from x$kcvfh
  4                                union
  5                                select to_char(min(f.fhscn)) from x$kcvfh f, v$datafile d
  6                                where f.hxfil =d.file#
  7                                and d.enabled != 'READ ONLY'
  8                                );

MIN_SCN
----------------------------------------
960237   <<<<<<<<<<<<< Take this scn no for rman backup from primary database 




On primary !!!!!!!!!!!!!!!


[oracle@ora INC]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jan 21 19:59:49 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORAEE (DBID=2924703949)

RMAN>  BACKUP INCREMENTAL FROM SCN 960237 DATABASE FORMAT '/home/oracle/INC/ForStandby1_%U' tag 'FORSTANDBY2';  ---<<<<<<<<<<  

Starting backup at 21-JAN-17

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=44 device type=DISK
backup will be obsolete on date 28-JAN-17
archived logs will not be kept or backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/oraee/oraee/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/oraee/oraee/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/oraee/oraee/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/oraee/oraee/users01.dbf
channel ORA_DISK_1: starting piece 1 at 21-JAN-17
channel ORA_DISK_1: finished piece 1 at 21-JAN-17
piece handle=/home/oracle/INC/ForStandby1_0qrqjr9t_1_1 tag=FORSTANDBY2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:04:48

using channel ORA_DISK_1
backup will be obsolete on date 28-JAN-17
archived logs will not be kept or backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 21-JAN-17
channel ORA_DISK_1: finished piece 1 at 21-JAN-17
piece handle=/home/oracle/INC/ForStandby1_0rrqjriu_1_1 tag=FORSTANDBY2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 21-JAN-17

RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/home/oracle/INC/ForStandbyCTRL1.bck' tag 'ControlFile2';

Starting backup at 21-JAN-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
channel ORA_DISK_1: starting piece 1 at 21-JAN-17
channel ORA_DISK_1: finished piece 1 at 21-JAN-17
piece handle=/home/oracle/INC/ForStandbyCTRL1.bck tag=CONTROLFILE2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 21-JAN-17

Starting Control File and SPFILE Autobackup at 21-JAN-17
piece handle=/u01/app/oracle/product/11.2.0/dbhome_3/dbs/c-2924703949-20170121-04 comment=NONE
Finished Control File and SPFILE Autobackup at 21-JAN-17

RMAN>



scp all the backup file from primary database  to standby database  !!!!!!!!!!!!!!!!!!



On standby !!!!!!!!!!!!!

ls -ltr /home/oracle/INC/
total 47160
-rw-r----- 1 oracle oinstall 10452992 Jan 21 11:47 ForStandby_0grqiue3_1_1
-rw-r----- 1 oracle oinstall  9797632 Jan 21 11:47 ForStandby_0hrqiuf7_1_1
-rw-r----- 1 oracle oinstall   441856 Jan 21 12:18 ArchORAEE_0mrqj08o_1_1_933855512
-rw-r----- 1 oracle oinstall  8003584 Jan 21 20:04 ForStandby1_0qrqjr9t_1_1
-rw-r----- 1 oracle oinstall  9797632 Jan 21 20:04 ForStandby1_0rrqjriu_1_1
-rw-r----- 1 oracle oinstall  9797632 Jan 21 20:07 ForStandbyCTRL1.bck


SQL> shutdown immediate ;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.

SQL> startup nomount ;
ORACLE instance started.

Total System Global Area  534462464 bytes
Fixed Size                  2215064 bytes
Variable Size             167773032 bytes
Database Buffers          360710144 bytes
Redo Buffers                3764224 bytes
SQL> exit
Disconnected from Oracle Database 11g Release 11.2.0.1.0 - 64bit Production

[oracle@ora ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jan 21 20:09:26 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORAEE (not mounted)

RMAN> RESTORE STANDBY CONTROLFILE FROM '/home/oracle/INC/ForStandbyCTRL1.bck' ;

Starting restore at 21-JAN-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/oraeed/control01.ctl
Finished restore at 21-JAN-17

RMAN> startup mount ;

database is already started
database mounted
released channel: ORA_DISK_1

RMAN> CATALOG START WITH '/home/oracle/INC';

searching for all files that match the pattern /home/oracle/INC

List of Files Unknown to the Database
=====================================
File Name: /home/oracle/INC/ForStandbyCTRL1.bck

Do you really want to catalog the above files (enter YES or NO)? NO

RMAN> RECOVER DATABASE NOREDO;

Starting recover at 21-JAN-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/app/oracle/oradata/oraeed/system01.dbf
destination for restore of datafile 00002: /u01/app/oracle/oradata/oraeed/sysaux01.dbf
destination for restore of datafile 00003: /u01/app/oracle/oradata/oraeed/undotbs01.dbf
destination for restore of datafile 00004: /u01/app/oracle/oradata/oraeed/users01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/INC/ForStandby1_0qrqjr9t_1_1
channel ORA_DISK_1: piece handle=/home/oracle/INC/ForStandby1_0qrqjr9t_1_1 tag=FORSTANDBY2
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

Finished recover at 21-JAN-17

RMAN> exit


Recovery Manager complete.
[oracle@ora ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sat Jan 21 20:11:07 2017

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


Connected to:
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/ArchiveEED
Oldest online log sequence     20
Next log sequence to archive   22
Current log sequence           22

SQL> select INST_ID, min(fhscn), min(FHRBA_SEQ) from x$kcvfh group by inst_id;  

   INST_ID MIN(FHSCN)       MIN(FHRBA_SEQ)
---------- ---------------- --------------
         1 965195                       22

SQL> recover managed standby database disconnect;
Media recovery complete.


SQL> archive log list ;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/ArchiveEED
Oldest online log sequence     20
Next log sequence to archive   22
Current log sequence           22


break on INST_ID
set pages 1000 lines 150
COL GROUP#    for a15
col status    for a20
select INST_ID,PROCESS,STATUS,SEQUENCE#,THREAD#,GROUP#,PID from GV$MANAGED_STANDBY
order by INST_ID,STATUS;

   INST_ID PROCESS   STATUS                SEQUENCE#    THREAD# GROUP#                 PID
---------- --------- -------------------- ---------- ---------- --------------- ----------
         1 ARCH      CONNECTED                     0          0 N/A                   4516
           ARCH      CONNECTED                     0          0 N/A                   4518
           ARCH      CONNECTED                     0          0 N/A                   4520
           ARCH      CONNECTED                     0          0 N/A                   4522
           MRP0      WAIT_FOR_LOG                 22          1 N/A                   4564  <<<<<<<<< Now archive

Sunday 15 January 2017

Recover Tablespace

Oracle Recover Tablespace . 



ERROR at line 1:
ORA-00376: file 5  cannot be read at this time
ORA-01110: data file 5: '/u01/app/oracle/oradata/oraeed/anuj01.dbf'

for search key !!
ORA-00376: file   cannot be read at this time
ORA-01110: data file : 


Taking Backup .. 


RUN {
configure controlfile autobackup on;
set command id to 'ORCLEEDBackupFull';
ALLOCATE CHANNEL c1 DEVICE TYPE disk;
backup AS COMPRESSED BACKUPSET full database tag ORCLEED_FULL format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_FULL' ;
sql 'alter system archive log current';
backup tag ORCLEED_ARCHIVE format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_ARCHIVE' archivelog all delete all input ;
backup tag ORCLEED_CONTROL current controlfile format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_CONTROL';
release channel c1;
}



RMAN>
RUN {
configure controlfile autobackup on;

RMAN> 2> set command id to 'ORCLEEDBackupFull';
ALLOCATE CHANNEL c1 DEVICE TYPE disk;
backup AS COMPRESSED BACKUPSET full database tag ORCLEED_FULL format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_FULL' ;
sql 'alter system archive log current';
backup tag ORCLEED_ARCHIVE format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_ARCHIVE' archivelog all delete all input ;
backup tag ORCLEED_CONTROL current controlfile format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_CONTROL';
release channel c1;
}
3> 4> 5> 6> 7> 8> 9> 10>
using target database control file instead of recovery catalog
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

executing command: SET COMMAND ID

allocated channel: c1
channel c1: SID=42 device type=DISK

Starting backup at 15-JAN-17
channel c1: starting compressed full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/oraeed/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/oraeed/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/oraeed/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/oraeed/users01.dbf
channel c1: starting piece 1 at 15-JAN-17



channel c1: finished piece 1 at 15-JAN-17
piece handle=/u01/app/oracle/RmanBackup/ORAEED_20170115_18_1_FULL tag=ORCLEED_FULL comment=NONE
channel c1: backup set complete, elapsed time: 00:05:16
Finished backup at 15-JAN-17

Starting Control File and SPFILE Autobackup at 15-JAN-17
piece handle=/u01/app/oracle/RmanBackup/c-2939668799-20170115-08.bck comment=NONE
Finished Control File and SPFILE Autobackup at 15-JAN-17

sql statement: alter system archive log current

Starting backup at 15-JAN-17
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=9 RECID=9 STAMP=933362415
input archived log thread=1 sequence=10 RECID=10 STAMP=933367281
input archived log thread=1 sequence=11 RECID=11 STAMP=933367281
channel c1: starting piece 1 at 15-JAN-17
channel c1: finished piece 1 at 15-JAN-17
piece handle=/u01/app/oracle/RmanBackup/ORAEED_20170115_20_1_ARCHIVE tag=ORCLEED_ARCHIVE comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/u01/app/oracle/ArchiveEED/1_9_933325760.dbf RECID=9 STAMP=933362415
archived log file name=/u01/app/oracle/ArchiveEED/1_10_933325760.dbf RECID=10 STAMP=933367281
archived log file name=/u01/app/oracle/ArchiveEED/1_11_933325760.dbf RECID=11 STAMP=933367281
Finished backup at 15-JAN-17

Starting backup at 15-JAN-17
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 15-JAN-17
channel c1: finished piece 1 at 15-JAN-17
piece handle=/u01/app/oracle/RmanBackup/ORAEED_20170115_21_1_CONTROL tag=ORCLEED_CONTROL comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-JAN-17

Starting Control File and SPFILE Autobackup at 15-JAN-17
piece handle=/u01/app/oracle/RmanBackup/c-2939668799-20170115-09.bck comment=NONE
Finished Control File and SPFILE Autobackup at 15-JAN-17

released channel: c1



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

set linesize 200
col FILE_NAME for a70
SELECT TABLESPACE_NAME, FILE_NAME FROM DBA_DATA_FILES ORDER BY TABLESPACE_NAME;


TABLESPACE_NAME                FILE_NAME
------------------------------ ----------------------------------------------------------------------
SYSAUX                         /u01/app/oracle/oradata/oraeed/sysaux01.dbf
SYSTEM                         /u01/app/oracle/oradata/oraeed/system01.dbf
UNDOTBS1                       /u01/app/oracle/oradata/oraeed/undotbs01.dbf
USERS                          /u01/app/oracle/oradata/oraeed/users01.dbf




Created tablespace ....

SQL> CREATE TABLESPACE anuj DATAFILE '/u01/app/oracle/oradata/oraeed/anuj01.dbf' SIZE 10M  AUTOEXTEND ON;

Tablespace created.


set linesize 200
col FILE_NAME for a70
SELECT TABLESPACE_NAME, FILE_NAME FROM DBA_DATA_FILES ORDER BY TABLESPACE_NAME;

SQL> SQL>
TABLESPACE_NAME                FILE_NAME
------------------------------ ----------------------------------------------------------------------
ANUJ                           /u01/app/oracle/oradata/oraeed/anuj01.dbf  ----<<<<<<
SYSAUX                         /u01/app/oracle/oradata/oraeed/sysaux01.dbf
SYSTEM                         /u01/app/oracle/oradata/oraeed/system01.dbf
UNDOTBS1                       /u01/app/oracle/oradata/oraeed/undotbs01.dbf
USERS                          /u01/app/oracle/oradata/oraeed/users01.dbf




SQL> create table anuj_table tablespace anuj as select * from dual;

Table created.

SQL> select * from anuj_table;

D
-
X


SQL> !rm /u01/app/oracle/oradata/oraeed/anuj01.dbf

SQL> !ls -ltr /u01/app/oracle/oradata/oraeed/
total 1367728
drwxr-x--- 3 oracle oinstall      4096 Jan 15 09:09 ORAEED
-rw-r----- 1 oracle oinstall  20979712 Jan 15 10:09 temp01.dbf
-rw-r----- 1 oracle oinstall  31465472 Jan 15 20:36 undotbs01.dbf
-rw-r----- 1 oracle oinstall 492838912 Jan 15 20:36 sysaux01.dbf
-rw-r----- 1 oracle oinstall   5251072 Jan 15 20:36 users01.dbf
-rw-r----- 1 oracle oinstall  52429312 Jan 15 20:41 redo01.log
-rw-r----- 1 oracle oinstall  52429312 Jan 15 20:41 redo02.log
-rw-r----- 1 oracle oinstall 702554112 Jan 15 20:53 system01.dbf
-rw-r----- 1 oracle oinstall  52429312 Jan 15 20:54 redo03.log
-rw-r----- 1 oracle oinstall  10076160 Jan 15 20:55 control01.ctl




SQL> insert into anuj_table values('t');

1 row created.

SQL> commit;

Commit complete.

SQL> alter system switch logfile;

System altered.

SQL> insert into anuj_table values('t');
insert into anuj_table values('t')
            *
ERROR at line 1:
ORA-00376: file 5 cannot be read at this time
ORA-01110: data file 5: '/u01/app/oracle/oradata/oraeed/anuj01.dbf'


Starting recovery .... 


SQL> alter tablespace anuj offline immediate;

Tablespace altered.



SQL> exit
Disconnected from Oracle Database 11g Release 11.2.0.1.0 - 64bit Production

[oracle@ora RmanBackup]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jan 15 21:05:44 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORAEED (DBID=2939668799)


RMAN> restore datafile 5;

Starting restore at 15-JAN-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK

creating datafile file number=5 name=/u01/app/oracle/oradata/oraeed/anuj01.dbf
restore not done; all files read only, offline, or already restored
Finished restore at 15-JAN-17



RMAN> recover datafile 5;

Starting recover at 15-JAN-17
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:02

Finished recover at 15-JAN-17



[oracle@ora RmanBackup]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Jan 15 21:08:45 2017

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


Connected to:
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production

SQL> select * from anuj_table ;
select * from anuj_table
              *
ERROR at line 1:
ORA-00376: file 5 cannot be read at this time
ORA-01110: data file 5: '/u01/app/oracle/oradata/oraeed/anuj01.dbf'


SQL> alter tablespace anuj online;

Tablespace altered.

SQL> select * from anuj_table ;

D
-
X
t

Friday 6 January 2017

Create Restore point On Oracle Standard Edition (no Flashback technology) and recovery ..


Create Restore point On Oracle Standard Edition (no Flashback technology) and recovery .. ..



Take Oracle backup via rman ..


RMAN> RUN
 {
 configure controlfile autobackup on;
set command id to 'ORCLEEBackupFull';
ALLOCATE CHANNEL c1 DEVICE TYPE disk;
backup AS COMPRESSED BACKUPSET full database tag ORCLEE_FULL format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_FULL' ;
sql 'alter system archive log current';
backup tag ORCLEE_ARCHIVE format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_ARCHIVE' archivelog all delete all input ;
backup tag ORCLEE_CONTROL current controlfile format '/u01/app/oracle/RmanBackup/%d_%T_%s_%p_CONTROL';
release channel c1;
}

old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

executing command: SET COMMAND ID



allocated channel: c1

channel c1: SID=34 device type=DISK

Starting backup at 06-JAN-17

channel c1: starting compressed full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/oraee/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/oraee/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/oraee/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/oraee/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/oraee/users01.dbf
channel c1: starting piece 1 at 06-JAN-17
channel c1: finished piece 1 at 06-JAN-17
piece handle=/u01/app/oracle/RmanBackup/ORAEE_20170106_8_1_FULL tag=ORCLEE_FULL comment=NONE
channel c1: backup set complete, elapsed time: 00:01:45
Finished backup at 06-JAN-17

Starting Control File and SPFILE Autobackup at 06-JAN-17

piece handle=/u01/app/oracle/flash_recovery_area/ORAEE/autobackup/2017_01_06/o1_mf_s_932562080_d6z59152_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 06-JAN-17

sql statement: alter system archive log current


Starting backup at 06-JAN-17

current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=4 STAMP=932562082
channel c1: starting piece 1 at 06-JAN-17
channel c1: finished piece 1 at 06-JAN-17
piece handle=/u01/app/oracle/RmanBackup/ORAEE_20170106_10_1_ARCHIVE tag=ORCLEE_ARCHIVE comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/u01/app/oracle/ArchiveEE/1_1_932558267.dbf RECID=4 STAMP=932562082
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=5 RECID=3 STAMP=932558270
channel c1: starting piece 1 at 06-JAN-17
channel c1: finished piece 1 at 06-JAN-17
piece handle=/u01/app/oracle/RmanBackup/ORAEE_20170106_11_1_ARCHIVE tag=ORCLEE_ARCHIVE comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/u01/app/oracle/ArchiveEE/1_5_932550469.dbf RECID=3 STAMP=932558270
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=2 RECID=5 STAMP=932562082
channel c1: starting piece 1 at 06-JAN-17
channel c1: finished piece 1 at 06-JAN-17
piece handle=/u01/app/oracle/RmanBackup/ORAEE_20170106_12_1_ARCHIVE tag=ORCLEE_ARCHIVE comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/u01/app/oracle/ArchiveEE/1_2_932558267.dbf RECID=5 STAMP=932562082
Finished backup at 06-JAN-17

Starting backup at 06-JAN-17

channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 06-JAN-17
channel c1: finished piece 1 at 06-JAN-17
piece handle=/u01/app/oracle/RmanBackup/ORAEE_20170106_13_1_CONTROL tag=ORCLEE_CONTROL comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-JAN-17

Starting Control File and SPFILE Autobackup at 06-JAN-17

piece handle=/u01/app/oracle/flash_recovery_area/ORAEE/autobackup/2017_01_06/o1_mf_s_932562088_d6z598x6_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 06-JAN-17

released channel: c1


RMAN>

Recovery Manager complete.
RMAN> exit


SQL> def
DEFINE _DATE           = "06-01-2017 13:24:14" (CHAR)
DEFINE _CONNECT_IDENTIFIER = "oraee" (CHAR)
DEFINE _USER           = "SYS" (CHAR)
DEFINE _PRIVILEGE      = "AS SYSDBA" (CHAR)
DEFINE _SQLPLUS_RELEASE = "1102000100" (CHAR)
DEFINE _EDITOR         = "ed" (CHAR)
DEFINE _O_VERSION      = "Oracle Database 11g Release 11.2.0.1.0 - 64bit Production" (CHAR)   <<<<< Oracle version 
DEFINE _O_RELEASE      = "1102000100" (CHAR)



SQL> select * from v$version ;

BANNER
--------------------------------------------------------------------
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production


[oracle@ora oracle]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 6 13:09:50 2017

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


Connected to:
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production

SQL>
create table restore_test (data_date date, Col1 varchar2(50));

Table created.

SQL> insert into restore_test values (sysdate, 'Before Restore Point');

1 row created.

SQL> commit ;

Commit complete.

SQL> create restore point Before_upgrade ;

Restore point created.

SQL>

set linesize 200
col name for a30
select scn, to_char(time,'dd.mm.yyyy hh24:mi:ss') time, name  from v$restore_point;

       SCN TIME                NAME
---------- ------------------- ------------------------------
    987489 06.01.2017 13:13:48 BEFORE_UPGRADE


SQL> insert into restore_test values (sysdate, 'AFTER RESTORE POINT');

1 row created.

SQL> insert into restore_test values (sysdate, 'UPGRADE ACTIONS PERFORMED');

1 row created.

SQL> commit ;

Commit complete.


SQL> alter session set nls_date_format='dd-mm-yyyy hh24:mi:ss' ;

Session altered.

SQL>  select * from restore_test ;

DATA_DATE           COL1
------------------- --------------------------------------------------
06-01-2017 13:13:33 Before Restore Point
06-01-2017 13:14:10 AFTER RESTORE POINT
06-01-2017 13:14:22 UPGRADE ACTIONS PERFORMED



SQL> commit ;

Commit complete.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.


SQL> exit


Recovery Manager complete.
[oracle@ora oracle]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 6 13:17:08 2017

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

Connected to an idle instance.

SQL> startup mount ;
ORACLE instance started.

Total System Global Area  534462464 bytes
Fixed Size                  2215064 bytes
Variable Size             167773032 bytes
Database Buffers          360710144 bytes
Redo Buffers                3764224 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 11g Release 11.2.0.1.0 - 64bit Production



[oracle@ora oracle]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jan 6 13:17:30 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORAEE (DBID=2923458434, not open)

RMAN> LIST RESTORE POINT ALL;

using target database control file instead of recovery catalog
SCN              RSP Time  Type       Time      Name
---------------- --------- ---------- --------- ----
987489                                06-JAN-17 BEFORE_UPGRADE



RMAN> restore database until restore point Before_upgrade ;

Starting restore at 06-JAN-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 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 00001 to /u01/app/oracle/oradata/oraee/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/oraee/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/oraee/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/oraee/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/oraee/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/RmanBackup/ORAEE_20170106_8_1_FULL
channel ORA_DISK_1: piece handle=/u01/app/oracle/RmanBackup/ORAEE_20170106_8_1_FULL tag=ORCLEE_FULL
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:15
Finished restore at 06-JAN-17


RMAN> recover database until restore point Before_upgrade ;

Starting recover at 06-JAN-17
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:02

Finished recover at 06-JAN-17

RMAN> sql 'alter database open resetlogs';

sql statement: alter database open resetlogs

RMAN> exit


Recovery Manager complete.


[oracle@ora oracle]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 6 13:21:07 2017

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


Connected to:
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production


SQL> alter session set nls_date_format='dd-mm-yyyy hh24:mi:ss' ;

Session altered.

SQL> select * from restore_test ;

DATA_DATE           COL1
------------------- --------------------------------------------------
06-01-2017 13:13:33 Before Restore Point                                  <<<<< Only one row :) 

Oracle DBA

anuj blog Archive