Thursday, January 28, 2016

red hat linux is stopped at loading bar after restart

[root@rac2 ~]# mount /dev/sr0 /media/
mount: block device /dev/sr0 is write-protected, mounting read-only
mount: /dev/sr0 already mounted or /media/ busy
mount: according to mtab, /dev/sr0 is already mounted on /media
[root@rac2 ~]#
[root@rac2 ~]#
[root@rac2 ~]# cd /media/
[root@rac2 media]# ls
32Bit  AUTORUN.INF  cert  runasroot.sh            VBoxSolarisAdditions.pkg        VBoxWindowsAdditions.exe
64Bit  autorun.sh   OS2   VBoxLinuxAdditions.run  VBoxWindowsAdditions-amd64.exe  VBoxWindowsAdditions-x86.exe
[root@rac2 media]# ls -lah
total 51M
dr-xr-xr-x.  6 root root 2.0K Jan 20 03:46 .
dr-xr-xr-x. 27 root root 4.0K Jan 28 13:52 ..
dr-xr-xr-x.  2 root root 2.0K Jan 20 03:46 32Bit
dr-xr-xr-x.  2 root root 2.0K Jan 20 03:46 64Bit
-r-xr-xr-x.  1 root root  647 Aug 20 21:47 AUTORUN.INF
-r-xr-xr-x.  1 root root 6.8K Jan 20 04:41 autorun.sh
dr-xr-xr-x.  2 root root 2.0K Jan 20 03:46 cert
dr-xr-xr-x.  2 root root 2.0K Jan 20 03:46 OS2
-r-xr-xr-x.  1 root root 5.4K Jan 20 04:41 runasroot.sh
-r-xr-xr-x.  1 root root 7.2M Jan 20 04:41 VBoxLinuxAdditions.run
-r-xr-xr-x.  1 root root  17M Jan 20 05:42 VBoxSolarisAdditions.pkg
-r-xr-xr-x.  1 root root  17M Jan 20 04:45 VBoxWindowsAdditions-amd64.exe
-r-xr-xr-x.  1 root root 309K Jan 20 04:40 VBoxWindowsAdditions.exe
-r-xr-xr-x.  1 root root 9.8M Jan 20 04:41 VBoxWindowsAdditions-x86.exe
[root@rac2 media]#
[root@rac2 media]#
[root@rac2 media]#
[root@rac2 media]# ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.14 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.14 of VirtualBox Guest Additions...
Stopping VirtualBox Additions [  OK  ]
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
The following X.Org/XFree86 configuration files were not restored, as they may
have been changed since they were generated by the VirtualBox Guest Additions.
You may wish to restore these manually.  The file name in brackets is the
original version.
  /etc/X11/xorg.conf (no original)
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module[  OK  ]
Building the shared folder support module[  OK  ]
Building the OpenGL support module[FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong. The module is not built but the others are.)
Doing non-kernel setup of the Guest Additions[  OK  ]
Starting the VirtualBox Guest Additions [  OK  ]
Installing the Window System drivers
Installing X.Org Server 1.15 modules[  OK  ]
Setting up the Window System to use the Guest Additions[  OK  ]
You may need to restart the the Window System (or just restart the guest system)
to enable the Guest Additions.
Installing graphics libraries and desktop services components[  OK  ]
You have new mail in /var/spool/mail/root
[root@rac2 media]#
Broadcast message from root@rac2.localdomain
        (/dev/pts/0) at 14:05 ...
The system is going down for reboot NOW!

Thursday, January 7, 2016

Restart CDB

In order to restart CDB we need to log in as common user which has perviliege to perform this operation and second thing is you need to connect without tns names.

This is done using unsetting the TWO_TASK variable. Below is how I would do it.

[oracle@localhost harvey]$ echo $TWO_TASK
[oracle@localhost harvey]$ sqlplus "/ as sysdba"
 set pages 10000 lines 270 long 10000
SQL*Plus: Release 12.1.0.1.0 Production on Wed Jan 6 23:01:07 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
CDB$ROOT@ORCL> CDB$ROOT@ORCL>
CDB$ROOT@ORCL>
CDB$ROOT@ORCL> show con_name
CON_NAME
------------------------------
CDB$ROOT
CDB$ROOT@ORCL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
CDB$ROOT@ORCL>
CDB$ROOT@ORCL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@localhost harvey]$
[oracle@localhost harvey]$
[oracle@localhost harvey]$ ps -ef | grep smon
oracle   11602 32410  0 23:01 pts/2    00:00:00 grep smon
[oracle@localhost harvey]$ sqlplus "/ as sysdba"
 set pages 10000 lines 270 long 10000
SQL*Plus: Release 12.1.0.1.0 Production on Wed Jan 6 23:02:03 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to an idle instance.
idle> idle>
idle> startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area  413372416 bytes
Fixed Size                  2289016 bytes
Variable Size             335544968 bytes
Database Buffers           71303168 bytes
Redo Buffers                4235264 bytes
Database mounted.
Database opened.
idle> show user
USER is "SYS"
idle>     
[oracle@localhost harvey]$ ps -ef | grep smon
oracle   11634     1  0 23:02 ?        00:00:00 ora_smon_orcl
oracle   11762 32410  0 23:05 pts/2    00:00:00 grep smon
[oracle@localhost harvey]$  

unplug and plug the pluggable database.


22:29:43 CDB$ROOT@ORCL> select * from cdb_pdbs;
    PDB_ID PDB_NAME            DBID    CON_UID GUID                             STATUS        CREATION_SCN     CON_ID
---------- ------------- ---------- ---------- -------------------------------- ------------- ------------ ----------
         3 PDB1          3345156736 3345156736 F0832BAF14721281E045000000000001 NORMAL             3238038          1
         2 PDB$SEED      4080030308 4080030308 F081641BB43F0F7DE045000000000001 NORMAL             1720754          1
         4 MICHAELPDB1   4078413767 4078413767 28B29D2DABB27F6FE055000000000001 NORMAL             3239858          1
Elapsed: 00:00:00.01
22:29:44 CDB$ROOT@ORCL> select * from v$containers;
    CON_ID       DBID    CON_UID GUID                             NAME         OPEN_MODE  RES OPEN_TIME                   CREATE_SCN TOTAL_SIZE
---------- ---------- ---------- -------------------------------- ------------ ---------- --- --------------------------- ---------- ----------
         1 1365223133          1 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT     READ WRITE NO  06-JAN-16 09.44.12.979 PM            0  975175680
         2 4080030308 4080030308 F081641BB43F0F7DE045000000000001 PDB$SEED     READ ONLY  NO  06-JAN-16 09.44.12.980 PM      1720754  283115520
         3 3345156736 3345156736 F0832BAF14721281E045000000000001 PDB1         READ WRITE NO  06-JAN-16 10.19.36.099 PM      3238038  291045376
         4 4078413767 4078413767 28B29D2DABB27F6FE055000000000001 MICHAELPDB1  READ WRITE NO  06-JAN-16 10.28.58.525 PM      3239858  283115520
Elapsed: 00:00:00.00
22:29:47 CDB$ROOT@ORCL> alter pluggable database michaelpdb1 close;
Pluggable database altered.
Elapsed: 00:00:00.30
22:29:58 CDB$ROOT@ORCL> select * from cdb_pdbs;
    PDB_ID PDB_NAME            DBID    CON_UID GUID                             STATUS        CREATION_SCN     CON_ID
---------- ------------- ---------- ---------- -------------------------------- ------------- ------------ ----------
         3 PDB1          3345156736 3345156736 F0832BAF14721281E045000000000001 NORMAL             3238038          1
         2 PDB$SEED      4080030308 4080030308 F081641BB43F0F7DE045000000000001 NORMAL             1720754          1
         4 MICHAELPDB1   4078413767 4078413767 28B29D2DABB27F6FE055000000000001 NORMAL             3239858          1
Elapsed: 00:00:00.01
22:30:06 CDB$ROOT@ORCL> select * from v$containers;
    CON_ID       DBID    CON_UID GUID                             NAME         OPEN_MODE  RES OPEN_TIME                   CREATE_SCN TOTAL_SIZE
---------- ---------- ---------- -------------------------------- ------------ ---------- --- --------------------------- ---------- ----------
         1 1365223133          1 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT     READ WRITE NO  06-JAN-16 09.44.12.979 PM            0  975175680
         2 4080030308 4080030308 F081641BB43F0F7DE045000000000001 PDB$SEED     READ ONLY  NO  06-JAN-16 09.44.12.980 PM      1720754  283115520
         3 3345156736 3345156736 F0832BAF14721281E045000000000001 PDB1         READ WRITE NO  06-JAN-16 10.19.36.099 PM      3238038  291045376
         4 4078413767 4078413767 28B29D2DABB27F6FE055000000000001 MICHAELPDB1  MOUNTED        06-JAN-16 10.29.58.171 PM      3239858          0
Elapsed: 00:00:00.01
22:30:09 CDB$ROOT@ORCL>
22:30:13 CDB$ROOT@ORCL> alter pluggable database michaelpdb1 unplug into '/u01/oracle/harvey/michaelpdb1.xml';
Pluggable database altered.
Elapsed: 00:00:01.35
22:31:41 CDB$ROOT@ORCL> select * from cdb_pdbs;                    
    PDB_ID PDB_NAME            DBID    CON_UID GUID                             STATUS        CREATION_SCN     CON_ID
---------- ------------- ---------- ---------- -------------------------------- ------------- ------------ ----------
         3 PDB1          3345156736 3345156736 F0832BAF14721281E045000000000001 NORMAL             3238038          1
         2 PDB$SEED      4080030308 4080030308 F081641BB43F0F7DE045000000000001 NORMAL             1720754          1
         4 MICHAELPDB1   4078413767 4078413767 28B29D2DABB27F6FE055000000000001 UNPLUGGED          3239858          1
Elapsed: 00:00:00.04
22:32:10 CDB$ROOT@ORCL> select * from v$containers;
    CON_ID       DBID    CON_UID GUID                             NAME         OPEN_MODE  RES OPEN_TIME                   CREATE_SCN TOTAL_SIZE
---------- ---------- ---------- -------------------------------- ------------ ---------- --- --------------------------- ---------- ----------
         1 1365223133          1 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT     READ WRITE NO  06-JAN-16 09.44.12.979 PM            0  975175680
         2 4080030308 4080030308 F081641BB43F0F7DE045000000000001 PDB$SEED     READ ONLY  NO  06-JAN-16 09.44.12.980 PM      1720754  283115520
         3 3345156736 3345156736 F0832BAF14721281E045000000000001 PDB1         READ WRITE NO  06-JAN-16 10.19.36.099 PM      3238038  291045376
         4 4078413767 4078413767 28B29D2DABB27F6FE055000000000001 MICHAELPDB1  MOUNTED        06-JAN-16 10.31.41.694 PM      3239858          0
Elapsed: 00:00:00.02
22:32:21 CDB$ROOT@ORCL> drop pluggable database michaelpdb1;
Pluggable database dropped.
Elapsed: 00:00:00.73
22:32:34 CDB$ROOT@ORCL> select * from cdb_pdbs;      
    PDB_ID PDB_NAME            DBID    CON_UID GUID                             STATUS        CREATION_SCN     CON_ID
---------- ------------- ---------- ---------- -------------------------------- ------------- ------------ ----------
         3 PDB1          3345156736 3345156736 F0832BAF14721281E045000000000001 NORMAL             3238038          1
         2 PDB$SEED      4080030308 4080030308 F081641BB43F0F7DE045000000000001 NORMAL             1720754          1
Elapsed: 00:00:00.01
22:32:40 CDB$ROOT@ORCL> select * from v$containers;
    CON_ID       DBID    CON_UID GUID                             NAME         OPEN_MODE  RES OPEN_TIME                   CREATE_SCN TOTAL_SIZE
---------- ---------- ---------- -------------------------------- ------------ ---------- --- --------------------------- ---------- ----------
         1 1365223133          1 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT     READ WRITE NO  06-JAN-16 09.44.12.979 PM            0  975175680
         2 4080030308 4080030308 F081641BB43F0F7DE045000000000001 PDB$SEED     READ ONLY  NO  06-JAN-16 09.44.12.980 PM      1720754  283115520
         3 3345156736 3345156736 F0832BAF14721281E045000000000001 PDB1         READ WRITE NO  06-JAN-16 10.19.36.099 PM      3238038  291045376
Elapsed: 00:00:00.01
22:32:42 CDB$ROOT@ORCL> create pluggable database pdb2 using '/u01/oracle/harvey/michaelpdb1.xml' nocopy;
Pluggable database created.
Elapsed: 00:00:02.15
22:33:13 CDB$ROOT@ORCL> select * from cdb_pdbs;
    PDB_ID PDB_NAME            DBID    CON_UID GUID                             STATUS        CREATION_SCN     CON_ID
---------- ------------- ---------- ---------- -------------------------------- ------------- ------------ ----------
         3 PDB1          3345156736 3345156736 F0832BAF14721281E045000000000001 NORMAL             3238038          1
         2 PDB$SEED      4080030308 4080030308 F081641BB43F0F7DE045000000000001 NORMAL             1720754          1
         4 PDB2          4078413767 4078413767 28B29D2DABB27F6FE055000000000001 NEW                3241128          1
Elapsed: 00:00:00.01
22:33:15 CDB$ROOT@ORCL> select * from v$containers;
    CON_ID       DBID    CON_UID GUID                             NAME         OPEN_MODE  RES OPEN_TIME                   CREATE_SCN TOTAL_SIZE
---------- ---------- ---------- -------------------------------- ------------ ---------- --- --------------------------- ---------- ----------
         1 1365223133          1 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT     READ WRITE NO  06-JAN-16 09.44.12.979 PM            0  975175680
         2 4080030308 4080030308 F081641BB43F0F7DE045000000000001 PDB$SEED     READ ONLY  NO  06-JAN-16 09.44.12.980 PM      1720754  283115520
         3 3345156736 3345156736 F0832BAF14721281E045000000000001 PDB1         READ WRITE NO  06-JAN-16 10.19.36.099 PM      3238038  291045376
         4 4078413767 4078413767 28B29D2DABB27F6FE055000000000001 PDB2         MOUNTED        06-JAN-16 10.33.13.169 PM      3241128          0
Elapsed: 00:00:00.01
22:33:18 CDB$ROOT@ORCL> alter pluggable database pdb2 open read write;
Pluggable database altered.
Elapsed: 00:00:05.95
22:33:35 CDB$ROOT@ORCL> select * from cdb_pdbs;
    PDB_ID PDB_NAME            DBID    CON_UID GUID                             STATUS        CREATION_SCN     CON_ID
---------- ------------- ---------- ---------- -------------------------------- ------------- ------------ ----------
         3 PDB1          3345156736 3345156736 F0832BAF14721281E045000000000001 NORMAL             3238038          1
         2 PDB$SEED      4080030308 4080030308 F081641BB43F0F7DE045000000000001 NORMAL             1720754          1
         4 PDB2          4078413767 4078413767 28B29D2DABB27F6FE055000000000001 NORMAL             3241128          1
Elapsed: 00:00:00.09
22:33:36 CDB$ROOT@ORCL> select * from v$containers;
    CON_ID       DBID    CON_UID GUID                             NAME         OPEN_MODE  RES OPEN_TIME                   CREATE_SCN TOTAL_SIZE
---------- ---------- ---------- -------------------------------- ------------ ---------- --- --------------------------- ---------- ----------
         1 1365223133          1 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT     READ WRITE NO  06-JAN-16 09.44.12.979 PM            0  975175680
         2 4080030308 4080030308 F081641BB43F0F7DE045000000000001 PDB$SEED     READ ONLY  NO  06-JAN-16 09.44.12.980 PM      1720754  283115520
         3 3345156736 3345156736 F0832BAF14721281E045000000000001 PDB1         READ WRITE NO  06-JAN-16 10.19.36.099 PM      3238038  291045376
         4 4078413767 4078413767 28B29D2DABB27F6FE055000000000001 PDB2         READ WRITE NO  06-JAN-16 10.33.29.532 PM      3241128  283115520
Elapsed: 00:00:00.04
22:33:38 CDB$ROOT@ORCL> 

Create pluggable database

Create pluggable database
PDB1@ORCL> alter session set container=cdb$root;
Session altered.
PDB1@ORCL> set lines 350
PDB1@ORCL> select * from cdb_pdbs;
    PDB_ID PDB_NAME    DBID    CON_UID GUID                             STATUS        CREATION_SCN     CON_ID
---------- ----------- ---------- ---------- -------------------------------- ------------- ------------ ----------
         2 PDB$SEED    4080030308 4080030308 F081641BB43F0F7DE045000000000001 NORMAL             1720754          1
         3 PDB1        3345156736 3345156736 F0832BAF14721281E045000000000001 NORMAL             2244252          1
PDB1@ORCL>
17:11:23 PDB1@ORCL> create pluggable database pdbmic1 admin user admin1 identified by admin1 roles=(connect);
Pluggable database created.
Elapsed: 00:00:59.45
17:13:38 PDB1@ORCL>
17:14:47 PDB1@ORCL> select * from cdb_pdbs;
    PDB_ID PDB_NAME         DBID    CON_UID GUID                             STATUS        CREATION_SCN     CON_ID
---------- ---------- ---------- ---------- -------------------------------- ------------- ------------ ----------
         2 PDB$SEED   4080030308 4080030308 F081641BB43F0F7DE045000000000001 NORMAL             1720754          1
         3 PDB1       3345156736 3345156736 F0832BAF14721281E045000000000001 NORMAL             2244252          1
         4 PDBMIC1    4078413767 4078413767 28B29D2DABB27F6FE055000000000001 NEW                3212466          1
Elapsed: 00:00:00.14
17:14:58 PDB1@ORCL> alter pluggable database pdbmic1 open read write;
Pluggable database altered.
Elapsed: 00:00:18.29
17:15:54 PDB1@ORCL> select * from cdb_pdbs;
    PDB_ID PDB_NAME         DBID    CON_UID GUID                             STATUS        CREATION_SCN     CON_ID
---------- ---------- ---------- ---------- -------------------------------- ------------- ------------ ----------
         2 PDB$SEED   4080030308 4080030308 F081641BB43F0F7DE045000000000001 NORMAL             1720754          1
         3 PDB1       3345156736 3345156736 F0832BAF14721281E045000000000001 NORMAL             2244252          1
         4 PDBMIC1    4078413767 4078413767 28B29D2DABB27F6FE055000000000001 NORMAL             3212466          1
Elapsed: 00:00:00.34
17:16:50 PDB1@ORCL> show user
USER is "SYS"
17:17:06 PDB1@ORCL> 

Wednesday, January 6, 2016

oracle 12c gives ORA-01017: invalid username/password; logon denied while sqlplus / as sysdba

[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Jan 6 00:37:18 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied

Enter user-name: ^C
[oracle@localhost ~]$
[oracle@localhost ~]$
[oracle@localhost ~]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Jan 6 00:37:30 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
PDB1@ORCL>
PDB1@ORCL> show con_name
CON_NAME
------------------------------
PDB1
PDB1@ORCL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@localhost ~]$
[oracle@localhost ~]$
[oracle@localhost ~]$ echo $TWO_TASK
pdb1
[oracle@localhost ~]$ TWO_TASK=
[oracle@localhost ~]$ echo $TWO_TASK
[oracle@localhost ~]$
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Jan 6 00:38:02 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
CDB$ROOT@ORCL> show con_name
CON_NAME
------------------------------
CDB$ROOT
CDB$ROOT@ORCL>