Thursday 27 February 2014

Loss of all controlfile when database is in archive log mode?

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/d02/oracle/oradata/orcl/control01.ctl
/d02/oracle/flash_recovery_area/orcl/control02.ctl
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@wasiq orcl]$ rm /d02/oracle/oradata/orcl/control01.ctl /d02/oracle/flash_recovery_area/orcl/control02.ctl   ==>Very pricarious command !!! (Don' t this in live environments) 
++++++++++++++++++++
shutdown abort the database
++++++++++++++++++++
SQL> shutdown abort
ORACLE instance shut down.
SQL>

+++++++++++++++++++++++++++++++++
start the instance in nomount and create controlfile
++++++++++++++++++++++++++++++++++++++
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1372651520 bytes
Fixed Size                  1336428 bytes
Variable Size             385878932 bytes
Database Buffers          973078528 bytes
Redo Buffers               12357632 bytes
SQL>

[oracle@wasiq orcl]$ rman

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jan 1 12:43:08 2014

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

RMAN> connect target /;
connected to target database: ORCL (not mounted)
RMAN> restore controlfile from '/d02/oracle/flash_recovery_area/ORCL/backupset/2014_01_01/o1_mf_ncnnf_TAG20140101T123654_9d7hnhvf_.bkp';  ==>or  from autobackup
Starting restore at 01-JAN-14
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/d02/oracle/oradata/orcl/control01.ctl
output file name=/d02/oracle/flash_recovery_area/orcl/control02.ctl
Finished restore at 01-JAN-14
RMAN>

+++++++++++++++++++++++++++++++++
change the database stage to mount
+++++++++++++++++++++++++++++++++
RMAN> sql 'alter database mount';
sql statement: alter database mount
released channel: ORA_DISK_1
RMAN> recover database;
Starting recover at 01-JAN-14
Starting implicit crosscheck backup at 01-JAN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=129 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=193 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=6 device type=DISK
Crosschecked 7 objects
Finished implicit crosscheck backup at 01-JAN-14
Starting implicit crosscheck copy at 01-JAN-14
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
Finished implicit crosscheck copy at 01-JAN-14
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /d02/oracle/flash_recovery_area/ORCL/backupset/2014_01_01/o1_mf_ncnnf_TAG20140101T123654_9d7hnhvf_.bkp
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
starting media recovery
archived log for thread 1 with sequence 13 is already on disk as file /d02/oracle/flash_recovery_area/ORCL/archivelog/2014_01_01/o1_mf_1_13_9d7hlvxo_.arc
archived log for thread 1 with sequence 14 is already on disk as file /d02/oracle/oradata/orcl/redo02.log
archived log file name=/d02/oracle/flash_recovery_area/ORCL/archivelog/2014_01_01/o1_mf_1_13_9d7hlvxo_.arc thread=1 sequence=13
archived log file name=/d02/oracle/oradata/orcl/redo02.log thread=1 sequence=14
media recovery complete, elapsed time: 00:00:00
Finished recover at 01-JAN-14
RMAN> sql 'alter database open resetlogs';
sql statement: alter database open resetlogs
RMAN>


Note : Take backup of the full database .

Loss of all datafiles when the database is in archive log mode?

In live Environments ,we will schedule full/Incremental/Cumulative backup's and it depends on the orginization or business needs.

Let's see how to resolve this issue when we lost all the datafiles and we have full backup of the database.



SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/d02/oracle/oradata/orcl/users01.dbf
/d02/oracle/oradata/orcl/undotbs01.dbf
/d02/oracle/oradata/orcl/sysaux01.dbf
/d02/oracle/oradata/orcl/system01.dbf
/d02/oracle/oradata/orcl/users02.dbf
/d02/oracle/oradata/orcl/users06

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

SQL>


[oracle@wasiq orcl]$ pwd
/d02/oracle/oradata/orcl
[oracle@wasiq orcl]$ ls -tlrh
total 1.6G
-rw-r----- 1 oracle dba  21M Jan  1 09:28 temp01.dbf
-rw-r----- 1 oracle dba  51M Jan  1 09:41 redo03.log
-rw-r----- 1 oracle dba  51M Jan  1 09:41 redo02.log
-rw-r----- 1 oracle dba 101M Jan  1 09:41 users06
-rw-r----- 1 oracle dba 101M Jan  1 10:42 users02.dbf
-rw-r----- 1 oracle dba 5.1M Jan  1 10:42 users01.dbf
-rw-r----- 1 oracle dba 671M Jan  1 12:11 system01.dbf
-rw-r----- 1 oracle dba 481M Jan  1 12:13 sysaux01.dbf
-rw-r----- 1 oracle dba  51M Jan  1 12:15 undotbs01.dbf
-rw-r----- 1 oracle dba  51M Jan  1 12:15 redo01.log
-rw-r----- 1 oracle dba 9.3M Jan  1 12:16 control01.ctl


++++++++++++++++++++++++++++++++++++++++++
Due to human error all the datafiles are lost
+++++++++++++++++++++++++++++++++++++++++
/d02/oracle/oradata/orcl
[oracle@wasiq orcl]$ ls -tlrh
total 1.6G
-rw-r----- 1 oracle dba  21M Jan  1 09:28 temp01.dbf
-rw-r----- 1 oracle dba  51M Jan  1 09:41 redo03.log
-rw-r----- 1 oracle dba  51M Jan  1 09:41 redo02.log
-rw-r----- 1 oracle dba 101M Jan  1 09:41 users06
-rw-r----- 1 oracle dba 101M Jan  1 10:42 users02.dbf
-rw-r----- 1 oracle dba 5.1M Jan  1 10:42 users01.dbf
-rw-r----- 1 oracle dba 671M Jan  1 12:16 system01.dbf
-rw-r----- 1 oracle dba  51M Jan  1 12:17 undotbs01.dbf
-rw-r----- 1 oracle dba 481M Jan  1 12:17 sysaux01.dbf
-rw-r----- 1 oracle dba  51M Jan  1 12:17 redo01.log
-rw-r----- 1 oracle dba 9.3M Jan  1 12:17 control01.ctl
[oracle@wasiq orcl]$ rm *.dbf
[oracle@wasiq orcl]$ ls -tlrh
total 260M
-rw-r----- 1 oracle dba  51M Jan  1 09:41 redo03.log
-rw-r----- 1 oracle dba  51M Jan  1 09:41 redo02.log
-rw-r----- 1 oracle dba 101M Jan  1 09:41 users06
-rw-r----- 1 oracle dba  51M Jan  1 12:17 redo01.log
-rw-r----- 1 oracle dba 9.3M Jan  1 12:17 control01.ctl
[oracle@wasiq orcl]$


++++++++++++++++++++++++++++++++++
shutdown the database with abort option
++++++++++++++++++++++++++++++++++
SQL> shutdown abort;
ORACLE instance shut down.
SQL>


++++++++++++++++++++++++++
mount the database
++++++++++++++++++++++
SQL> startup mount ;
ORACLE instance started.

Total System Global Area 1372651520 bytes
Fixed Size                  1336428 bytes
Variable Size             385878932 bytes
Database Buffers          973078528 bytes
Redo Buffers               12357632 bytes
Database mounted.

[oracle@wasiq orcl]$ rman

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jan 1 12:21:24 2014

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

RMAN> connect target /;

connected to target database: ORCL (DBID=1362912542, not open)

RMAN> restore database;

Starting restore at 01-JAN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=129 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=192 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=6 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 /d02/oracle/oradata/orcl/users02.dbf
channel ORA_DISK_1: restoring datafile 00006 to /d02/oracle/oradata/orcl/users06
channel ORA_DISK_1: reading from backup piece /backup/rman/orcl/28dec2013/ORCL_db_u0tosm0kr_s29_p1_t835388059_db
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00002 to /d02/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_2: restoring datafile 00003 to /d02/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_2: reading from backup piece /backup/rman/orcl/28dec2013/ORCL_db_u0sosm0kr_s28_p1_t835388059_db
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00004 to /d02/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_3: reading from backup piece /backup/rman/orcl/28dec2013/ORCL_db_u0rosm0kr_s27_p1_t835388059_db
channel ORA_DISK_4: starting datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_DISK_4: restoring datafile 00001 to /d02/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_4: reading from backup piece /d02/oracle/flash_recovery_area/ORCL/backupset/2014_01_01/o1_mf_nnndf_TAG20140101T121123_9d7g4n8d_.bkp
channel ORA_DISK_3: piece handle=/backup/rman/orcl/28dec2013/ORCL_db_u0rosm0kr_s27_p1_t835388059_db tag=TAG20131228T201419
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: piece handle=/backup/rman/orcl/28dec2013/ORCL_db_u0tosm0kr_s29_p1_t835388059_db tag=TAG20131228T201419
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:08
channel ORA_DISK_2: piece handle=/backup/rman/orcl/28dec2013/ORCL_db_u0sosm0kr_s28_p1_t835388059_db tag=TAG20131228T201419
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:36
channel ORA_DISK_4: piece handle=/d02/oracle/flash_recovery_area/ORCL/backupset/2014_01_01/o1_mf_nnndf_TAG20140101T121123_9d7g4n8d_.bkp tag=TAG20140101T121123
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:00:36
Finished restore at 01-JAN-14
RMAN> recover database;
Starting recover at 01-JAN-14
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 01-JAN-14

RMAN> sql 'alter database open';
sql statement: alter database open
RMAN> exit

Recovery Manager complete.
[oracle@wasiq orcl]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 1 12:23:29 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

SQL>

Tuesday 18 February 2014

How to start weblogic server?




Go to domain home location and source . ./setDomainEnv.sh file and start weblogic server.

 Starting weblogic server with the script "startWeblogic.sh"
 if we have installed/created the domain in "production mode" Above script will ask for weblogic "username" and "password" .

If you want to run "weblogic server" in the background it requires setting one configuration file that is
boot.properties file which have to be created in this location $DOMAIN_HOME/server/AdminServer/security/boot.properties file.

boot.properties file contain username and password in encrypted format so whenever we execute
startWeblogic.sh it will decrypt username and password from boot.properties file and open the admin console for administration purpose.

if you want start weblogic server in the background use this below command.

cd $DOMAIN_HOME/bin
nohup ./startWeblogic.sh &

If we have installed/created weblogic domain in "Development Mode" there is boot.properites file is created where as incase of production mode it is not created thats why we have to provide the credentails at prompt for production mode.


Showing  message as running in the bottom of the above screen.


provide credentails



It will open a GUI console for administration.





Quote of the day !!!!!!
  --------------------------
Sooner or later, those who win are those who think they can





Saturday 15 February 2014

JRockit Installation on Linux 5



To install JRockit, download the latest Linux x86-64 version from here  http://www.oracle.com/technetwork/middleware/jrockit/downloads/index.html, 
then make the file executable and run it:


++++++++++++++++++++++++++++++++++++
Copying the files to software directory
+++++++++++++++++++++++++++++++++++++
[fusion@wlsadmin software]$ pwd
/u01/software
[fusion@wlsadmin software]$ cp -r /mnt/hgfs/weblogicsoftware/jrockit-jdk1.6.0_45-R28.2.7-4.1.0-linux-x64.bin . &
[1] 6018
[fusion@wlsadmin software]$ jobs
[1]+  Done                    cp -r /mnt/hgfs/weblogicsoftware/jrockit-jdk1.6.0_45-R28.2.7-4.1.0-linux-x64.bin .
[fusion@wlsadmin software]$ ls -tlrh jrockit-jdk1.6.0_45-R28.2.7-4.1.0-linux-x64.bin
-rwxrwxr-x 1 fusion fusion 125M Feb 10 11:29 jrockit-jdk1.6.0_45-R28.2.7-4.1.0-linux-x64.bin
[fusion@wlsadmin software]$ pwd
/u01/software
[fusion@wlsadmin software]$ chmod +x jrockit-jdk1.6.0_45-R28.2.7-4.1.0-linux-x64.bin
[fusion@wlsadmin software]$ ./jrockit-jdk1.6.0_45-R28.2.7-4.1.0-linux-x64.bin
Extracting 0%....................................................................................................100%
[fusion@wlsadmin software]$

Click the "Next" button on the welcome screen



Enter the relevant installation directory and click the "Next" button.

Pick any required optional components and click the "Next" button.


Wait for the installation to complete, then click the "Done" button.




-----------------------------------------------------------------------
Now set your environment and make sure Java is referencing the JRockit JDK:
----------------------------------------------------------------------------

[fusion@wlsadmin Jrockit1.6.0_45]$ export JAVA_HOME=/u01/Jrockit1.6.0_45
[fusion@wlsadmin Jrockit1.6.0_45]$ export PATH=$JAVA_HOME/bin:$PATH
[fusion@wlsadmin Jrockit1.6.0_45]$ which java
/u01/Jrockit1.6.0_45/bin/java
[fusion@wlsadmin Jrockit1.6.0_45]$ 


Once Jrockit is installed,Start weblogic installation.
Click on the below link to see in details.
http://abduulwasiq.blogspot.in/2014/02/oracle-weblogic-server-wls-12c-release_8161.html





How to un install weblogic product?



When we un install the weblogic product the entry is removed from the registry.xml file but files are exists physically in the operating system.

Oracle WebLogic Server (WLS) 12c Release 2 (12.1.2) Installation on Oracle Linux 5 on 64 bit.

































Friday 14 February 2014

How to change weblogic admin console port number in 12c?


1)Login to weblogic admin console
My url is http://wlsadmin.user.com:8001/console
Where "console" is the name of application or context name.




Once you logged in to admin console.


Click on Environment tab you will see "servers" tab.
Click on servers button.
It will show you the list of servers details.

Click on LOCK & EDIT tab .


Click on checkbox "AdminServer"

Now change the port number from 8001 to 8050.



Click on Save and then Activate Changes.


Once we changed the port number it doesnot require bounce/re start.

Just log out and login with the new URL.
http://wlsadmin.user.com:8050/console.