Thursday, 8 February 2018

Linux installation on Virtual Box

Creating the Virtual Machine:



- Specifying the RAM size for VM


-Creating Disk type





-Specifying the Machine location and name, defining the Virtual Hard drive size:


- Machine created and now selecting the ISO image for the OS:



- Performing test, it can be skipped:




> Next

>Language Selection




Basic Storage


Specifying Host Name:

Configuring Network (Ip and Subnet mask)





Coutry/Region Selection:



Setting the root password:



Create Customer layout (Partitioning the disks according to your needs)





Start Installation:


Reboot after installation:













Log in through root:



Step by Step Linux Installation (From Virtual Machine creation to Linux installation)


Creating Share Disks / Storages for Oracle RAC in Virtual Box (linux)


Creating shared disks for Oracle RAC on VB:

1- Click on Node1 and right click settings:


2- Click on storage: righ click> add SATA controller



3-  Select Sata Controller:

4- Sata Controller wiil be added:



5- Click the Plus sign on SATA controller added:



6- Choose create new disk:


7-  Choose Virtual Disk Image


8- Choose Fixed size


9- Give it a name and location:


10- Create the disk after specifying the paths:




11- Once the Disk is created, now its the time to mark it shareable, File>Vitual media manager>





12- All the disks added will be displayed, click on properties;


13- select Type>from normal to shareable


14- as below:


15- Apply the changes:


16- it will be mark as shareable:



17- Now click on other Node which you want these disk to be shareable, similarly enable sata disk control as done in Node 1:


19- Add disk>



20- Above we have to select choose existing disk> select it from location where we created for first node:


21- select the disk and click ok:



22- Now if you check the disk property from any node, it should be shareable as shown below:


ORA-01078: failure in processing system parameters

Most often with fresh DBAs after installing the oracle on linux and setting the environment faced below error message while starting the Database Instance:

ORA-01078: failure in processing system parameters

you did below like setting environment for the instance,i.e oracle sid and oracle home,base etc

[oracle@racnode1 ~]$ . db.env
[oracle@racnode1 ~]$ cat db.env
TMP=/tmp; export TMP
    TMPDIR=$TMP; export TMPDIR

    ORACLE_HOSTNAME=racnode1; export ORACLE_HOSTNAME
    ORACLE_UNQNAME=testdb; export ORACLE_UNQNAME
    ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0; export ORACLE_HOME
    ORACLE_SID=testdb; export ORACLE_SID
    PATH=/usr/sbin:$PATH; export PATH
    PATH=$ORACLE_HOME/bin:$PATH; export PATH

    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
    CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
[oracle@racnode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 7 17:37:27 2018

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

Connected to an idle instance.

SQL> startup;
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbs/inittestdb.ora'
SQL>

Issue:

Everything else is fine but issue is that oracle SID given during creation of DB is not matching with the environment variable set. In above scenario Oracle is trying to find pfile with name inittestdb.ora but actual file
initTESTDB.ora.

cd $ORACLE_HOME/dbs

-rw-r----- 1 oracle oinstall   39 Feb  7 16:36 initTESTDB1.ora


Solution:

Simple solution will be to set SID name according to SID name given during creation of DB.

Like:

login through oracle user

$ export ORACLE_SID=TESTDB;

OR setting it in enviroment variable file

oracle@racnode1 ~]$ vi db.env
TMP=/tmp; export TMP
    TMPDIR=$TMP; export TMPDIR

    ORACLE_HOSTNAME=racnode1; export ORACLE_HOSTNAME
    ORACLE_UNQNAME=TESTDB; export ORACLE_UNQNAME
    ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0; export ORACLE_HOME
    ORACLE_SID=TESTDB; export ORACLE_SID
    PATH=/usr/sbin:$PATH; export PATH
    PATH=$ORACLE_HOME/bin:$PATH; export PATH

    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
    CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH


[oracle@racnode1 ~]$ . db.env
[oracle@racnode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 7 18:13:35 2018

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, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options

SQL> select open_mode from v$database;

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

SQL>

Or as below:

When login through sqlplus , below error was noticed:



 If we check the Oracle Unique name and Oracle SID given is testdb:



Now setting both of the above variables to respective name:



Now setting the enviroment and run it again:






Thursday, 1 February 2018

Dropping ASM Disk Group having data in it and creating Disk group of same disks


This blog will let you know, if we have some data on diskgroup and we drop that disk group,  will it be possible to drop the disk containing data? and should it be possible to recover the same data by configure the diskgroup with the same name and same disks, should we get our data back?

No its not possible!!


-- Checking the database, its up and running

[oracle@testdb ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 1 11:14:44 2018

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, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL>

-- Log in from Grid user

[grid@testdb ~]$ asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576     10228    10052                0            5026              0             N  ARCH/
MOUNTED  NORMAL  N         512   4096  1048576     10228     7036                0            3518              0             N  DATA/
MOUNTED  NORMAL  N         512   4096  1048576     10228     9620                0            4810              0             N  FRA/
ASMCMD>

-- checking the data in FRA disk group

 Below folders and files are already moved to other Disk group (https://tauseefdba.blogspot.com/2018/01/moving-controlfile-in-asm-from-one.html):

ASMCMD> cd fra
ASMCMD> ls -l
Type  Redund  Striped  Time             Sys  Name
                                        Y    TESTDB/
ASMCMD> cd testdb
ASMCMD> ls
ARCHIVELOG/
CONTROLFILE/
ASMCMD> ls -l
Type  Redund  Striped  Time             Sys  Name
                                        Y    ARCHIVELOG/
                                        Y    CONTROLFILE/
ASMCMD>

-- Before dropping lets check that no DB parameter is pointing to this DG

SQL> show parameter control

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DATA/testdb/controlfile/curre
                                                 nt.260.966829689, +ARCH/testdb
                                                 /controlfile/control02.ctl
control_management_pack_access       string      DIAGNOSTIC+TUNING
SQL> show parameter recovery

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      +ARCH
db_recovery_file_dest_size           big integer 3852M
recovery_parallelism                 integer     0
SQL> show parameter arch

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target                   integer     0
log_archive_config                   string
log_archive_dest                     string
log_archive_dest_1                   string      location=+ARCH
log_archive_dest_10                  string

-- To check any DB file is on this DG

select name from v$controlfile
union
select name from v$datafile
union
select name from v$tempfile
union
select member from v$logfile
union
select filename from v$block_change_tracking
union
select name from v$flashback_database_logfile;


-- Now its the time to drop Disk group

We can drop disks by 2 ways:

1) login through sysasm in grid user

[grid@testdb bin]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 1 11:42:17 2018

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option

SQL>             
SQL>
SQL>
SQL> drop diskgroup FRA;
drop diskgroup FRA
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15053: diskgroup "FRA" contains existing files

SQL> drop diskgroup FRA including contents;

Diskgroup dropped.

SQL>

-- Run below command to check the Disk Group is removed properly

login from Grid user:

cd /u01/app/11.2.0/grid/bin

[grid@testdb bin]$ ./srvctl config database -d testdb
Database unique name: testdb
Database name: testdb
Oracle home: /u01/app/oracle/product/11.2.0
Oracle user: grid
Spfile: +DATA/testdb/spfiletestdb.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
PRCD-1012 : Failed to retrieve disk group list for database testdb.
PRCR-1035 : Failed to look up CRS resource ora.FRA.dg for testdb
PRCR-1001 : Resource ora.FRA.dg does not exist

-- Still we have FRA status not update we can do it as below

login from root user as it requires super user permissions:

[root@testdb ~]# cd /u01/app/11.2.0/grid/bin/

- Updated DG information

[root@testdb bin]# ./srvctl modify database -d testdb -a 'DATA,ARCH'

-- Now checking the status

[root@testdb bin]# ./srvctl config database -d testdb
Database unique name: testdb
Database name: testdb
Oracle home: /u01/app/oracle/product/11.2.0
Oracle user: grid
Spfile: +DATA/testdb/spfiletestdb.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA,ARCH
Services:
[root@testdb bin]#

2)  We can also drop the disk group server control utility  (srvctl) as well

Stopping the FRA  DG resources

[root@testdb bin]# ./srvctl stop diskgroup -g FRA

Dropping the Disk

[root@testdb bin]# ./srvctl remove diskgroup -g FRA

Checking the Status

[root@testdb bin]# ./srvctl config database -d testdb
Database unique name: testdb
Database name: testdb
Oracle home: /u01/app/oracle/product/11.2.0
Oracle user: grid
Spfile: +DATA/testdb/spfiletestdb.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA,ARCH
Services:
[root@testdb bin]#

Login through Grid User:

ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576     10228    10022                0            5011              0             N  ARCH/
MOUNTED  NORMAL  N         512   4096  1048576     10228     7036                0            3518              0             N  DATA/
ASMCMD> 

Installing Oracle 11g on Linux

Unpack Files Unzip the files. # 11.2.0.1 unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip #11.2.0.2 u...