Visit Counter

Sunday, November 17, 2013

Oracle Catalog Offline Backup Script


Oracle Catalog Offline Backup Script


Enviroment: Solaris 10 64-bit Sparc
                   Oracle DB 10.2.0





/opt/oracle10g

$ cat coldbk.sh

cd /opt/oracle10g/bin

rman target / nocatalog <<@

shutdown immediate;

startup mount;

run {

allocate channel ch1 type

disk format='/data1/db-offline/bk_%s_%p_%t';

backup (database);

release channel ch1;

startup;

}

 

 
$ ./coldbk.sh

Recovery Manager: Release 10.2.0.4.0 - Production on Thu Jan 20 10:30:01 2011

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

connected to target database: CATDB (DBID=927922687)

using target database control file instead of recovery catalog

RMAN>

database closed

database dismounted

Oracle instance shut down

RMAN>

connected to target database (not started)

Oracle instance started

database mounted

Total System Global Area 612368384 bytes

Fixed Size 2042528 bytes

Variable Size 209720672 bytes

Database Buffers 394264576 bytes

Redo Buffers 6340608 bytes

RMAN> 2> 3> 4> 5> 6> 7>

allocated channel: ch1

channel ch1: sid=157 devtype=DISK

Starting backup at 20-Jan-2011

channel ch1: starting full datafile backupset

channel ch1: specifying datafile(s) in backupset

input datafile fno=00005 name=/opt/oracle10g/oradata/catdb/rmants.dbf

input datafile fno=00001 name=/opt/oracle10g/oradata/catdb/system01.dbf

input datafile fno=00003 name=/opt/oracle10g/oradata/catdb/sysaux01.dbf

input datafile fno=00002 name=/opt/oracle10g/oradata/catdb/undotbs01.dbf

input datafile fno=00006 name=/opt/oracle10g/oradata/catdb/system2.dbf

input datafile fno=00004 name=/opt/oracle10g/oradata/catdb/users01.dbf

channel ch1: starting piece 1 at 20-JAN-11

channel ch1: finished piece 1 at 20-JAN-11

piece handle=/data1/db-offline-bk/bk_157_1_784117842 tag=TAG20120524T

103042 comment=NONE

channel ch1: backup set complete, elapsed time: 00:01:25

channel ch1: starting full datafile backupset

channel ch1: specifying datafile(s) in backupset

including current control file in backupset

including current SPFILE in backupset

channel ch1: starting piece 1 at 20-JAN-11

channel ch1: finished piece 1 at 20-JAN-11

piece handle=/data1/db-offline-bk/bk_158_1_784117928 tag=TAG20120524T

103042 comment=NONE

channel ch1: backup set complete, elapsed time: 00:00:05

Finished backup at 20-JAN-11

released channel: ch1

database is already started

database opened

RMAN>

RMAN>

RMAN>



Recovery Manager complete.

$

Installed Netbackup Database Agent on Solaris 10






/swap/netbackup/database/agent/
# ls
NBdbext  i386     install  sparc
# ls -l
total 124
drwxr-xr-x   4 root     root         512 Mar 27 15:39 NBdbext
drwxr-xr-x   4 root     root         512 Mar 27 15:39 i386
-rwxr--r--   1 root     root       60274 Mar 27 15:39 install
drwxr-xr-x   8 root     root         512 Mar 27 15:39 sparc
# ./install

**********

There are two ways to install database agent software.

1.  Remote Installation:  Loads the software on a server with
    the intent of pushing database software out to affected clients.

2.  Local Installation:   Loads and installs the software only to this
    local machine.

**********

Do you want to do a local installation? [y,n] (n) y



**********

        NetBackup Database Agent Installation

Choose the Database Agents you wish to install
one at a time or select Install All Database Agents.

        1)  NetBackup for DB2
        2)  NetBackup for Informix
        3)  NetBackup for Lotus Notes
        4)  NetBackup for Oracle
        5)  NetBackup for SAP
        6)  NetBackup for Sybase

        7)  Install All Database Agents

        q)  Done Selecting Agents
        x)  Exit from this Script

Choose an option: 4

Choose an option: q


You have chosen to install these Database Agents:

        NetBackup for Oracle

Is this list correct? [y,n] (y)

**********


Of the agents selected, the following are supported
on this platform and will be installed:

        Oracle

Loading the Database Agent packages into the
/usr/openv/netbackup/dbext directory and installing.


**********

        Installing NetBackup for Oracle



   Installing NetBackup for Oracle...

Extracting files from /usr/openv/netbackup/dbext/OEBU.solaris8.tar.Z ...
x usr/openv/netbackup, 0 bytes, 0 tape blocks
x usr/openv/netbackup/bin, 0 bytes, 0 tape blocks
x usr/openv/netbackup/bin/bpubsora, 194676 bytes, 381 tape blocks
x usr/openv/netbackup/bin/bpdbsbora, 291956 bytes, 571 tape blocks
x usr/openv/netbackup/bin/libobk.so.1, 112480 bytes, 220 tape blocks
x usr/openv/netbackup/bin/oracle_link, 32260 bytes, 64 tape blocks
x usr/openv/netbackup/bin/bporaexp, 122336 bytes, 239 tape blocks
x usr/openv/netbackup/bin/bporaimp, 134128 bytes, 262 tape blocks
x usr/openv/netbackup/bin/libobk.so64.1, 183360 bytes, 359 tape blocks
x usr/openv/netbackup/bin/bporaexp64, 151376 bytes, 296 tape blocks
x usr/openv/netbackup/bin/bporaimp64, 164088 bytes, 321 tape blocks
x usr/openv/netbackup/dbext, 0 bytes, 0 tape blocks
x usr/openv/netbackup/dbext/OEBU.solaris8.version, 28 bytes, 1 tape blocks
x usr/openv/netbackup/ext, 0 bytes, 0 tape blocks
x usr/openv/netbackup/ext/db_ext, 0 bytes, 0 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle, 0 bytes, 0 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples, 0 bytes, 0 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/rman, 0 bytes, 0 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/rman/cold_database_backup.sh, 11 875 bytes, 24 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/rman/cold_duplex_database_backup _full.sh, 12789 bytes, 25 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/rman/database_restore.sh, 7155 b ytes, 14 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/rman/hot_database_backup.sh, 115 38 bytes, 23 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/rman/hot_tablespace_backup.sh, 1 1154 bytes, 22 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/rman/pit_database_restore.sh, 10 307 bytes, 21 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/rman/hot_database_backup_proxy.s h, 9983 bytes, 20 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/rman/hot_tablespace_backup_proxy .sh, 8575 bytes, 17 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bpend_notify.oracle_bli.sh, 2776 4 bytes, 55 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bpstart_notify.oracle_bli.sh, 31 867 bytes, 63 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/post_checkpoint_notify.oracle_bl i.sh, 21844 bytes, 43 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaexp, 0 bytes, 0 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaexp/data_archiver_export.sh , 5124 bytes, 11 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaexp/data_archiver_export64. sh, 5130 bytes, 11 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaexp/bporaexp_help.param, 73 3 bytes, 2 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaexp/bporaexp_partitions.par am, 1605 bytes, 4 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaexp/bporaexp_table_to_files .param, 1652 bytes, 4 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaexp/bporaexp_tables.param, 1669 bytes, 4 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaexp/bporaexp_tables_rows.pa ram, 1868 bytes, 4 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp, 0 bytes, 0 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/data_archiver_import.sh , 5044 bytes, 10 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/data_archiver_import64. sh, 5050 bytes, 10 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_archive.param,  1242 bytes, 3 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_archive_schema _to_files.param, 1317 bytes, 3 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_archive_to_use rs.param, 1510 bytes, 3 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_bfile_table.pa ram, 1604 bytes, 4 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_help.param, 73 3 bytes, 2 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_ignore_rows_ta ble.param, 1530 bytes, 3 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_large_table.pa ram, 1542 bytes, 4 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_list.param, 15 94 bytes, 4 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_old_archive.pa ram, 1556 bytes, 4 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_partitions.par am, 1513 bytes, 3 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_table_from_fil es.param, 1370 bytes, 3 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_table_to_files .param, 1301 bytes, 3 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_table_to_user. param, 1656 bytes, 4 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/samples/bporaimp/bporaimp_tables.param, 1289 bytes, 3 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/bin, 0 bytes, 0 tape blocks
x usr/openv/netbackup/ext/db_ext/oracle/bin/setup_bli_scripts, 18091 bytes, 36 t ape blocks
x usr/openv/lib, 0 bytes, 0 tape blocks
x usr/openv/lib/libdbsbrman.so, 1765172 bytes, 3448 tape blocks
x usr/openv/lib/libbpora.so.8.0, 44232 bytes, 87 tape blocks
x usr/openv/lib/libbpora.so.9.0, 44244 bytes, 87 tape blocks
x usr/openv/lib/libbpora64.so.8.0, 61840 bytes, 121 tape blocks
x usr/openv/lib/libbpora64.so.9.0, 61848 bytes, 121 tape blocks
x usr/openv/lib/libnbberman.so, 112692 bytes, 221 tape blocks

LiveUpdate is not installed, skipping registration step...

NetBackup for Oracle installation completed.

**********

Execution of ./install_dbext is complete.


Execution of ./install is complete.

File /usr/openv/tmp/install_addon_trace.25104 contains a trace of this install.
#

Thursday, November 14, 2013

Startup and Shutdown Container Databases (CDB) and Pluggable Databases (PDB) in Oracle Database 12c R1



Startup and shutdown of the container database is the same as it has always been 
for regular instances. The SQL*Plus STARTUP and SHUTDOWN commands are 
available when connected to the CDB as a privileged user.
Some typical values are shown below.



Starting CDB (container database) will NOT OPEN PDB (pluggable database)

Use SHOW CON_NAME to know where you are at, i.e. CDB or PDB

Use ALL to have OPEN/CLOSE all PDB, i.e. ALTER PLUGGABLE DATABASE ALL OPEN;

Use ALTER SESSION to switch to PDB, i.e. alter session set container=PDB01;

$
SQL> SHOW CON_NAME

CON_NAME
----------------------------
CDB$ROOT


SQL> SHOW PDBS

CON_ID CON_NAME                                         OPEN MODE RESTRICTED
-----------------------------------------------------------------------

    2          PDB$SEED                                                 READ ONLY NO                  
    3          PDB1                                                         MOUNTED
    4          PDB2                                                         MONUTED


SQL> ALTER PLUGGABLE DATABASE ALL OPEN;

pluggable database altered.

SQL> SHOW PDBS

CON_ID CON_NAME                                         OPEN MODE RESTRICTED
-----------------------------------------------------------------------

    2          PDB$SEED                                                 READ ONLY NO                  
    3          PDB1                                                         READ WRITE NO
    4          PDB2                                                         READ WRITE NO

SQL> alter pluggable database all close;


CON_ID CON_NAME                                         OPEN MODE RESTRICTED
-------------------------------------------------------------------------------------
    2          PDB$SEED                                                 READ ONLY NO     
    3          PDB1                                                         MOUNTED
    4          PDB2                                                         MONUTED
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN;
pluggable database altered.
Accessing a Container in a CDB with SQL*Plus
SQL> alter session set container=PDB1;
session altered.
SQL> show con_name
con_name
--------------------------
PDB1

How to unplug a PDB and Plug it back into the same CDB



You have just unplugged a PDB and want to know how to eventually plug it back into the same container.
Let's assume I have a pluggable database named PDB1 and I am just able to unplug it using the following commands: 


Container Database:   CDB1
Pluggable Databases: PDB1 , PDB2


$ ORACLE_HOME='/ora/oracle/app/oracle/product/12.1.0/dbhome_1/bin
$ export ORACLE_HOME

$ ORACLE_SID=cdb1
$ export ORACLE_SID


SQL>  alter pluggable database pdb1 close immediate; 

Pluggable database altered.

SQL> alter pluggable database PDB1 unplug into '/ora/oracle/app/oracle/oradata/cdb1/pdb1.xml';    

Pluggable database altered.  


If you query the CDB_PDBS view you can receive useful information about all PDBs contained: id, name, unique identifiers, SCN at the time of creation and the status.
The STATUS column has several values:

  • NEW, the pdb has been created but never opened 
  • NORMAL, pdb available to be used 
  • UNPLUGGED, the pdb has been unplugged 
  • NEEDS UPGRADE, the pdb must be upgraded 
  • CONVERTING, a non-CDB is going to be converted into a pdb 
  • UNUSABLE, the pdb cannot be used (creation in progress) 
In my case the PDB1 pluggable database is in an UNPLUGGED status as expected: 


SQL> select * from CDB_PDBS;  

SQL> select * from CDB_PDBS;    

   PDB_ID PDB_NAME     DBID    CON_UID GUID        STATUS    CREATION_SCN     CON_ID  
---------- ---------- ---------- ---------- -------------------------------- ------------- ------------ ----------  

  2 PDB$SEED   4063489868 4063489868 E19363E52C005C9AE045000000000001 NORMAL      233   1  

  3 PDB2     1701599811 1701599811 E1F26215682E1142E045000000000001 NORMAL  1821405   1  

  4 PDB1     1497027100 1497027100 E1F329ECE0F411E6E045000000000001 UNPLUGGED  1844390   1  


To plug again the pluggable database PDB003 inside the original container (CDB001) you cannot use a syntax like: ALTER PLUGGABLE DATABASE ... PLUG (it doesn't exist in the "SQL Language Reference" manual a PLUG clause) ... 

SQL> alter pluggable database pdb1 plug;
alter plugable database pdb1 plug
                                            *
ERROR at line 1:
ORA-00922: missing or invalid option


... neither you can simply use CREATE PLUGGABLE DATABASE ... USING SQL> create pluggable database PDB003 using
 '/ora/oracle/app/oracle/oradata/cdb1/pdb1.xml' nocopy tempfile  reuse;

SQL> create pluggable database PDB003 using
          '/ora/oracle/app/oracle/oradata/cdb1/pdb1.xml' nocopy tempfile 

      reuse  *  ERROR at line 1:  
      ORA-65012: Pluggable database PDB003 already exists.  

you need first to drop the pluggable database (DROP PLUGGABLE DATABASE command) and then create it again (CREATE PLUGGABLE DATABASE command).
In this way the pluggable database is plugged again into the same CDB and using the same PDB name.
Have a look at the following commands: 


SQL> drop pluggable database PDB003;   

Pluggable database dropped.    

SQL> create pluggable database PDB1 using 
           '/ora/oracle/app/oracle/oradata/cdb1/pdb1.xml' nocopy;                   

Pluggable database created.    

SQL> select PDB_NAME, STATUS from CDB_PDBS;    

PDB_NAME   STATUS   
---------- -------------   
PDB$SEED   NORMAL   
PDB2       NORMAL   
PDB1       NEW    
  
SQL> alter session set container=PDB1;   

Session altered.    

SQL> alter database open;   

Database altered.    

SQL> select count(*) from emp.T1;    

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

       100  


Have a look again at the CDB_PDBS view and note the differences compared with the previous results.
All the unique identifiers of PDB003 have been recreated. 



Open another terminal & run the command.


SQL> select * from CDB_PDBS;   

   PDB_ID PDB_NAME     DBID    CON_UID GUID        STATUS    CREATION_SCN     CON_ID  ---------- ---------- ---------- ---------- -------------------------------- ------------- ------------ ----------  

2 PDB$SEED   4063489868 4063489868 E19363E52C005C9AE045000000000001 NORMAL      233   1 3 PDB1     1701599811 1701599811 E1F26215682E1142E045000000000001   NORMAL  1821405   1    4 PDB2     1497027100 1497027100 E1F329ECE0F411E6E045000000000001   NORMAL  1844390   1    




Wednesday, November 6, 2013

How to move the image catalog on a Solaris Server



Move Net backup catalog images to New location.


1. Shut down the NetBackup services on the master server. This may be done by running:

#  /usr/openv/netbackup/bin/netbackup stop

Check the status of Netbackup server.

# ./bpps -a 

2. Copy the contents of the /usr/openv/netbackup/db/images directory to its new location, then rename the old images directory to images_bak as a backup copy.

# cp -pr /usr/openv/netbackup/db/images /disk1/netbackup/db/images 


3. Rename the old images directory to images_bak as a backup copy:
# mv /usr/openv/netbackup/db/images /usr/openv/netbackup/db/images_bak 

4. Create a symbolic link from /usr/openv/netbackup/db/images to the new location:
# ln -s /disk1/netbackup/db/images /usr/openv/netbackup/db/images

5. Restart NetBackup services by running:

# /usr/openv/netbackup/bin/netbackup start

Tuesday, November 5, 2013

Unix Info about Processor & Core



number of physical cpu: "psrinfo -p"
number of cores: "kstat cpu_info|grep core_id|sort -u|wc -l"
number of threads: "psrinfo -pv"

Number of Physical CPU


# psrinfo -p

2

Number of Cores:

 # kstat cpu_info|grep core_id|sort -u|wc -l

  2

Number of threads:

 # psrinfo -pv

The physical processor has 1 virtual processor (0)
UltraSPARC-IIIi (portid 0 impl 0x16 ver 0x34 clock 1503 MHz)
The physical processor has 1 virtual processor (1)
UltraSPARC-IIIi (portid 1 impl 0x16 ver 0x34 clock 1503 MHz)





Sunday, November 3, 2013

Upgrade Firmware StorageTek SL24 Autoloader



Launch the Autoloader On-Board Remote Managment Interface (RMI) from a Web based browser by entering the IP address of the Autoloader in the browser address bar.

Caution: Before you perform the upload, make sure there are no processes or applications accessing the autoloader. If there are, shut down the process or application, or pause the operation, until the upload completes.

Login Account Type: Adminstrator

After entering the Adminstrator password,
select the Sign In button
Select the Support tab at the top of the page.
Select the Firmware tab under the Support banner.


















Use the Browse button to locate the firmware file (SUN_SL24_E.80.frm)
Select the Update button to start the firmware download.
Select the OK button when the Are you sure? message pops up on your screen.
On the left side of the screen, is a Download Progress bar.









A browser window will appear that states:
Autoloader Reboot
Please wait while the system is rebooting.
This page refreshes after 140 seconds.
If the page doesn't refresh automatically press the "refresh" button on your browser.
The Login screen will reappear in your browser.
Login into the Autoloader (User or Administrator, you many need to login twice)

The new Autoloader f/w level will be listed under Identity tab / Autloader tab.