Friday, August 30, 2013

RECOVER CONTROLFILE


ALTER TABLESPACE tbs01 RENAME TO tbs02;
crosscheck archivelog all;
delete expired archivelog all;
delete noprompt expired archivelog all;


startup nomount

CREATE CONTROLFILE SET  DATABASE "ORCL" RESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '/oracle/product/10.2.0/oradata/orcl/redo01.log'  SIZE 50M,
  9    GROUP 2 '/oracle/product/10.2.0/oradata/orcl/redo02.log'  SIZE 50M,
 10    GROUP 3 '/oracle/product/10.2.0/oradata/orcl/redo03.log'  SIZE 50M
 11  -- STANDBY LOGFILE
 12  DATAFILE
 13    '/oracle/product/10.2.0/oradata/orcl/system01.dbf',
 14    '/oracle/product/10.2.0/oradata/orcl/undotbs01.dbf',
 15    '/oracle/product/10.2.0/oradata/orcl/sysaux01.dbf',
 16    '/oracle/product/10.2.0/oradata/orcl/users01.dbf',
 17*   '/oracle/product/10.2.0/oradata/orcl/example01.dbf'
SQL> /

alter database open resetlogs;

############################################################
to change location using RMAN

run {
sql ' alter tablespace users offline';
set newname for datafile '/oracle/use1.dbf' to '/oracle/product/10.2.0/oradata/orcl/users01.dbf';
restore tablespace users;
switch datafile all;
recover tablespace users;
 }

                                     Oracle Managed Files location, you can use this
form of the command:
RUN {
    SET NEWNAME FOR DATAFILE 3 to NEW;
    RESTORE DATAFILE 3;
    SWITCH DATAFILE 3;
    RECOVER DATAFILE 3;
}



Thursday, August 29, 2013

TABLESPACE RECOVERY USING RMAN

SQL> select * from jobs;
select * from jobs
              *
ERROR at line 1:
ORA-01116: error in opening database file 5
ORA-01110: data file 5: '/oracle/product/10.2.0/oradata/orcl/example01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3


THE RESOLVE USING RMAN

FIRST MANDATORY

FULL BACKUP PLUS ARCHIVELOG

RMAN>  sql ' alter tablespace example offline immediate';

sql statement:  alter tablespace example offline immediate

RMAN> restore tablespace example;

RMAN> recover tablespace example;

Starting recover at 29-AUG-13
using channel ORA_DISK_1

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

Finished recover at 29-AUG-13

RMAN> sql ' alter tablespace example online';

sql statement:  alter tablespace example online


EXECUTE QUERY.....

Monday, August 5, 2013

CONNECT DATABASE REMOTELY

sqlplus hr/hr@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.146.134)(PORT=1521)))(CONNECT_DATA=(SID=orcl)))'

Thursday, August 1, 2013

INSTALL SQLDEVELOPER IN LINUX

STEP-1

Download and Install  sqldeveloper-3.2.20.09.87-1.noarch.rpm

STEP -2

Download and Install  jdk-7u21-linux-i586.rpm

STEP-3

define_editor=vi

chmod 777    /opt/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf

vi     /opt/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf
set Java path

/usr/java/jdk1.7.0_21/

type
sqldeveloper