Tuesday, March 8, 2016

how to trace /debug rman session for trouble shooting?

rman target / debug trace=<file_name>.

which will record the rman session details  into the file.

how to spool rman log in oracle database

rman target /

rman>spool log to '/tmp/rman.log'

rman>list backup of spfile;

rman> spool off

Thursday, March 3, 2016

Wednesday, January 27, 2016

steps to move data file to one disk group to another disk group


Move ASM files from one diskgroup to another diskgroup
---------------------------------------------------------------------------


Step 1: Get the data file name:

select   file_name from   dba_data_files where file_name like '%user%';

Step 2:  Identify the target diskgroup to migrate to:


select    name from    v$asm_diskgroup;
FRA

Step 3:  Take the old data file offline:

alter database datafile    '+DATA/RAC/DATAFILE/users.261.898200463' offline;

Step 4:  Copy the datafile to the new diskgroup (using RMAN)

$ rman target /

connected to target database: RAC (DBID=2486182530)


RMAN> copy datafile '+DATA/RAC/DATAFILE/users.261.898200463' to '+FRA';

Starting backup at 2-JAN-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=262 instance=RAC1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=+DATA/RAC/DATAFILE/users.261.898200463
output file name=+FRA/RAC/DATAFILE/users.271.902270597 tag=TAG20160127T224316 RECID=3 STAMP=902270598
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2-JAN-15

Starting Control File and SPFILE Autobackup at 2-JAN-15
piece handle=+FRA/RAC/AUTOBACKUP/2016_01_27/s_902270598.261.902270605 comment=NONE
Finished Control File and SPFILE Autobackup at 2-JAN-15


Step 6: Re-name the data file:

SQL> alter database rename file  '+DATA/RAC/DATAFILE/users.261.898200463'  to  '+FRA/RAC/DATAFILE/users.271.902270597';

Step 7: Get the new filename:

SQL> select   file_name from   dba_data_files where file_name like '%user%';

FILE_NAME
--------------------------------------------------------------------------------
+FRA/RAC/DATAFILE/users.271.902270597

Step 8: Rename the RMAN data file:

RMAN> switch datafile '+FRA/RAC/DATAFILE/users.271.902270597' to copy;

using target database control file instead of recovery catalog
datafile 6 switched to datafile copy "+FRA/RAC/DATAFILE/users.271.902270597"

Step 9: Use RMAN recovery to the new data file:

RMAN> recover datafile '+FRA/RAC/DATAFILE/users.271.902270597';

Starting recover at 2-JAN-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=284 instance=RAC1 device type=DISK

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

Finished recover at 2-JAN-15


Step 10:  Put the data file online:

RMAN> alter database datafile '+FRA/RAC/DATAFILE/users.271.902270597' online;

Statement processed


After Oracle renames the ASM database file in the data dictionary, it will remove the original ASM database file

steps to move oracle Data file online one location to another location in oracle 12c

In Oracle 12c  we can move Oracle  data file online.
Here is the steps for online movement.

SQL*Plus: Release 12.1.0.1.0 Production

SQL> select  file_name from dba_data_files where file_name like '%users01%';

FILE_NAME
--------------------------------------------------------------------------------

/u01/app/oracle/oradata/source/users01.dbf


SQL> ALTER DATABASE MOVE DATAFILE '/u01/app/oracle/oradata/source/users01.dbf' to '/u02/app/oracle/oradata/source/users01.dbf';

Database altered.

SQL> select  file_name from dba_data_files where file_name like '%users01%';

FILE_NAME
--------------------------------------------------------------------------------

/u02/app/oracle/oradata/source/users01.dbf

Thursday, January 21, 2016

oracle standby database important views used for troubleshooting.

select PROCESS,STATUS,SEQUENCE# from v$managed_standby;

select * from v$archive_gap;

select * from V$DATAGUARD_CONFIG;

select name,value from V$DATAGUARD_STATS;

select DEST_ID,ERROR_CODE,MESSAGE from V$DATAGUARD_STATUS

select DEST_NAME,RECOVERY_MODE,APPLIED_THREAD#,DESTINATION from V$archive_dest_status;

select name,APPLIED,STATUS ,FAL ,END_OF_REDO_TYPE from V$ARCHIVED_LOG

select PROCESS,AFFIRM,MAX_FAILURE,FAILURE_COUNT,NET_TIMEOUT,status ,DEST_NAME from V$ARCHIVE_DEST;

select * from V$archive;

select PROCESS,STATUS,STATE from V$ARCHIVE_PROCESSES;

select name,IS_RECOVERY_DEST_FILE,END_OF_REDO,SOURCE_DBID from V$FOREIGN_ARCHIVED_LOG;

select * from V$FS_FAILOVER_STATS;

select GROUP#,STATUS,USED from  V$STANDBY_LOG;

select name,count,LAST_TIME_UPDATED from  V$STANDBY_EVENT_HISTOGRAM;

v$logstdby_stats
v$logstdby_transaction
v$logstdby_process
v$logstdby_progress
v$logstdby_state

steps to create baseline for a SQL statement in oracle database


1. -- Creating SQL tuning set to load better plan from AWR repository

exec dbms_sqltune.create_sqlset(sqlset_name => 'dz7j81n20pfm4_sqlset_test',description => 'sqlset descriptions');

2. -- Selecting historical SQL from AWR and loading that plan into tuning set

declare
baseline_ref_cur DBMS_SQLTUNE.SQLSET_CURSOR;
begin
open baseline_ref_cur for
select VALUE(p) from table(
DBMS_SQLTUNE.SELECT_WORKLOAD_REPOSITORY(&begin_snap_id, &end_snap_id,'sql_id='||CHR(39)||'&sql_id'||CHR(39)||' and plan_hash_value=4245310385',NULL,NULL,NULL,NULL,NULL,NULL,'ALL')) p;
DBMS_SQLTUNE.LOAD_SQLSET('dz7j81n20pfm4_sqlset_test', baseline_ref_cur);
end;
/

-- input values..

sql id : dz7j81n20pfm4
bein snap: 38451
end snap: 38454

3. -- check to see tuning set was created above.

SELECT NAME,OWNER,CREATED,STATEMENT_COUNT FROM DBA_SQLSET where name='dz7j81n20pfm4_sqlset_test';

4. -- Load SQL and good plan into baseline

set serveroutput on
declare
my_int pls_integer;
begin
my_int := dbms_spm.load_plans_from_sqlset (
sqlset_name => 'dz7j81n20pfm4_sqlset_test',
basic_filter => 'sql_id="dz7j81n20pfm4" and plan_hash_value =4245310385',
sqlset_owner => 'SYS',
fixed => 'NO',
enabled => 'YES');
DBMS_OUTPUT.PUT_line(my_int);
end;
/

5. -- verify baseline is created

SELECT SQL_HANDLE, PLAN_NAME, ORIGIN, ENABLED, ACCEPTED, FIXED, MODULE FROM   DBA_SQL_PLAN_BASELINES;

Sunday, January 17, 2016

steps to install DDboost on AIX server

Here is the list of steps to install DDboost on AIX server.
----------------------------------------------------------------------

assumption we had already installed oracle software binaries on the target server and down load the DDBoost  and move to server.
untar the requested files.

rw-rw-r--    1 oracle   dba         5580800 Mar 06 2014  RMAN_1.1.1.3-415543_RMAN_aix_64.tar
(server_name:oracle)/oracle/ddboost>./install.sh
ksh: ./install.sh:  not found.
(server_name:oracle)/oracle/ddboost>install.sh
ksh: install.sh:  not found.
(server_name:oracle)/oracle/ddboost>sh install.sh
Installing the Data Domain plugin for RMAN ...
Copying libraries to /oracle/product/11gR2_3/lib
cp libddobk.so /oracle/product/11gR2_3/lib/libddobk.so
cp libDDBoost.so /oracle/product/11gR2_3/lib/libDDBoost.so
Successfully installed the Data Domain plugin for RMAN

step to install NZPORTAL on linux for Netezza applicance

Here is the list of steps  follow to install NZPORTAL for NPS appliance
---------------------------------------------------------------------------------------------------

rw-r--r--  1 root    root       71317688 Dec  8 12:20 nzportal.package.tar.z
[root@<server_name> netback]# tar -xvf  nzportal.package.tar.z
nzportal.2.0.0-4.tar
unpack
[root@<server_name> netback]# ls -ltr
total 12428300

-rw-r--r--  1 root    root       71317688 Dec  8 12:20 nzportal.package.tar.z
[root@<server_name> netback]# mkdir portal
[root@<server_name> netback]# cd portal
[root@<server_name> portal]# pwd
/netback/portal
[root@<server_name> portal]# ls -ltr
total 70476
-rw-r--r-- 1 root root 72087525 Dec  8 12:24 nz-portal-v2.0.0.4.tar.gz
[root@<server_name> portal]# tar -xvf nz-portal-v2.0.0.4.tar.gz
Netezza_portal_user_guide.pdf
nzportal.package.tar.z
NzPortal_Readme.txt
[root@<server_name> portal]# ls -tlr
total 141560
-rw-r--r-- 1 10507 12009 71317688 Mar  3  2014 nzportal.package.tar.z
-rw-r--r-- 1 10507 12009     3561 Mar  3  2014 NzPortal_Readme.txt
-rw-r--r-- 1 10507 12009  1385661 Mar  3  2014 Netezza_portal_user_guide.pdf
-rw-r--r-- 1 root  root  72087525 Dec  8 12:24 nz-portal-v2.0.0.4.tar.gz
[root@<server_name> portal]# tar -xvf nzportal.package.tar.z
nzportal.2.0.0-4.tar
unpack
[root@<server_name> portal]# ls -tlr
total 299668
-rwxr-xr-x 1 10507 12009     63620 Mar  3  2014 unpack
-rw-r--r-- 1 10507 12009 161669120 Mar  3  2014 nzportal.2.0.0-4.tar
-rw-r--r-- 1 10507 12009  71317688 Mar  3  2014 nzportal.package.tar.z
-rw-r--r-- 1 10507 12009      3561 Mar  3  2014 NzPortal_Readme.txt
-rw-r--r-- 1 10507 12009   1385661 Mar  3  2014 Netezza_portal_user_guide.pdf
-rw-r--r-- 1 root  root   72087525 Dec  8 12:24 nz-portal-v2.0.0.4.tar.gz
[root@<server_name> portal]# ./unpack
-------------------------------------------------------------------------------
IBM Netezza -- IBM Netezza Performance Portal 2.0.0.4
(C) Copyright IBM Corp. 2002, 2014  All Rights Reserved.
-------------------------------------------------------------------------------

Validating package checksum ... ok

Directory '/usr/local/nzWebAdmin' does not exist; create it (y/n)? [y] y
Checking the system...
This is NPS Appliance. OK
Checking if Apache server is already running:
http server is not running
Checking if IBM Netezza Performance Portal is already installed/running:
IBM Netezza Performance Portal is not running
******************************************************************************
Unpacking web application files into:  /usr/local/nzWebAdmin
******************************************************************************
Deleting existing cache files...

0%          25%         50%         75%          100%
|||||||||||||||||||||||||||||||||||||||||||||||||||


Installing web services RPMs ...
Searching for Installation of
Preparing...                ########################################### [100%]
   1:apr                    ########################################### [100%]
Searching for Installation of
Preparing...                ########################################### [100%]
   1:apr-util               ########################################### [100%]
Searching for Installation of
Preparing...                ########################################### [100%]
   1:distcache              ########################################### [100%]
Searching for Installation of
expat-1.95.8-8.3.el5_5.3.i386
expat-1.95.8-8.3.el5_5.3.i386.rpm already installed
Searching for Installation of
Preparing...                ########################################### [100%]
   1:freetype               ########################################### [100%]
Searching for Installation of
Preparing...                ########################################### [100%]
   1:gmp                    ########################################### [100%]
Searching for Installation of
Preparing...                ########################################### [100%]
   1:httpd                  ########################################### [100%]
Searching for Installation of
libidn-0.6.5-1.1.i386
libidn-0.6.5-1.1.i386.rpm already installed
Searching for Installation of
Preparing...                ########################################### [100%]
   1:libjpeg                ########################################### [100%]
Searching for Installation of
Preparing...                ########################################### [100%]
   1:libpng                 ########################################### [100%]
Searching for Installation of
Preparing...                ########################################### [100%]
   1:libxml2                ########################################### [100%]
Searching for Installation of
Preparing...                ########################################### [100%]
   1:mod_ssl                ########################################### [100%]
Searching for Installation of
Preparing...                ########################################### [100%]
   1:pcre                   ########################################### [100%]
Searching for Installation of
Preparing...                ########################################### [100%]
   1:postgresql-libs        ########################################### [100%]
Removing old link: /lib/libssl.so.6 to libssl.so.0.9.8e
Linking /lib/libssl.so.6 to /lib/libssl.so.0.9.8e
Removing old link: /lib64/libssl.so.6 to libssl.so.0.9.8e
Linking /lib64/libssl.so.6 to /lib64/libssl.so.0.9.8e
Removing old link: /lib/libcrypto.so.6 to libcrypto.so.0.9.8e
Linking /lib/libcrypto.so.6 to /lib/libcrypto.so.0.9.8e
Removing old link: /lib64/libcrypto.so.6 to libcrypto.so.0.9.8e
Linking /lib64/libcrypto.so.6 to /lib64/libcrypto.so.0.9.8e
Removing old link: /lib/libssl.so.4 to libssl.so.0.9.7a
Linking /lib/libssl.so.4 to /lib/libssl.so.6
Removing old link: /lib64/libssl.so.4 to libssl.so.0.9.7a
Linking /lib64/libssl.so.4 to /lib64/libssl.so.6
Removing old link: /lib/libcrypto.so.4 to libcrypto.so.0.9.7a
Linking /lib/libcrypto.so.4 to /lib/libcrypto.so.6
Removing old link: /lib64/libcrypto.so.4 to libcrypto.so.0.9.7a
Linking /lib64/libcrypto.so.4 to /lib64/libcrypto.so.6
Checking for existing SSL preferences in httpd.conf
Existing SSL preferences not found. SSL support is required and will be added.
******************************************************************************
Generating certificate for Apache SSL
******************************************************************************
Default SSL values settings:
Country Name: US
State or Province Name: New York
Locality Name: Endicott
Organization Name: International Business Machines Corporation
Organizational Unit Name: 07
Common Name: <server_name>
Do you want to use "US" as country name ? (y/n)? [y] y
Do you want to use "New York" as State or Province Name ? (y/n)? [y] n
State or Province Name (full name):
texas
Do you want to use "Endicott" as Locality Name ?  (y/n)? [y] n
Locality Name (eg, city):
dallas
Do you want to use "International Business Machines Corporation" as Organization Name ?  (y/n)? [y] n
Organization Name (eg, company):
<companay_name>
Do you want to use "07" Organizational Unit Name ?  (y/n)? [y] n
Organizational Unit Name (eg, section):
EDW
Do you want to use "<server_name>" as Common Name ?  (y/n)? [y] y

WARNING:
The existing file /etc/syslog.conf has been moved to
/etc/syslog.conf.old.30891

Shutting down kernel logger:                               [  OK  ]
Shutting down system logger:                               [  OK  ]
Starting system logger:                                    [  OK  ]
Starting kernel logger:                                    [  OK  ]
root: Starting nzSoapService server
                                                           [  OK  ]
Checking httpd v0 modules names on /etc/httpd/conf/httpd.conf file...
- mod_access :
   there is no reference to mod_access on httpd.conf file.
- mod_auth_dbm :
   there is no reference to mod_auth_dbm on httpd.conf file.
- mod_imap :
   there is no reference to mod_imap on httpd.conf file.
Starting httpd:                                            [  OK  ]

********************************************************************************

         Be sure to check your firewall settings for restrictions.
         If ports 80 and/or 443 are blocked, the web application
         will not be accessible.
         Please consult the NzPortal_Readme.txt file for more information.

         To connect to IBM Netezza Performance Portal
         please start a browser and point to:
         https://<server_name>/com.netezza.portal.Portal/index.html

******************************************************************************


Unpacking complete.
[root@<server_name> portal]# su - nz

     <server_name> NPS environment
==================================================

     HOME                 = /export/home/nz
     USER                 = nz

     NZ_USER              = admin
     NZ_DATABASE          = system


     /nz/data/config/system.cfg settings
==================================================

    startup.maxConnections    = 1000
    system.enableCTA2         = 1


[nz@<server_name> ~]$ exit
logout
[root@<server_name> portal]# service httpd status
httpd (pid  21877) is running...
[root@<server_name> portal]# service nzportal status
nzSoapService (pid 21471) is running...

https://<server_name>/com.netezza.portal.Portal/index.html

now login into the portal with default user and password and create your ownn user & password

RAc issues||CRS-4535: Cannot communicate with Cluster Ready Services


Here is the steps that I followed to clear the priority tickets.
-----------------------------------------------------------------------

connected to ASM instance on the 1st node via
sqlpls / as sysasm
o checked status of the diskgroups using
select name,state from v$asm_diskgroup;
all showed "DISMOUNTED"
o then issued
alter diskgroup OCRVD mount;
alter diskgroup DATBA mount;
alter diskgroup FRA mount;
all of which succeeded.
o next issued
crsctl start res ora.crsd -init
which started the CRS daemon
o checked CRS resources using
crsctl stat res -t
which showed that database resources are being started
o repeated the same on the 2nd node which succeeded
o databases now up & running again on both nodes