Monitor RMAN Operations

Hi Everybody,

It was a very long time since writing in this blog, here we are back again, actually, I was looking for a proper and accurate way to monitor the progress of RMAN backups, the below script can be used to monitor the progress efficiently:

select recid
, output_device_type
, dbsize_mbytes
, input_bytes/1024/1024 input_mbytes
, output_bytes/1024/1024 output_mbytes
, (output_bytes/input_bytes*100) compression
, (mbytes_processed/dbsize_mbytes*100) complete
, to_char(start_time + (sysdate-start_time)/(mbytes_processed/dbsize_mbytes),'DD-MON-YYYY HH24:MI:SS') est_complete
from v$rman_status rs
, (select sum(bytes)/1024/1024 dbsize_mbytes from v$datafile) 
where status='RUNNING'
and output_device_type is not null;

Also, I am using the below script to monitor the details of the RMAN backup progress and the other long operations activities:

SELECT SID, SERIAL#, opname, SOFAR, TOTALWORK,
ROUND(SOFAR/TOTALWORK*100,2) COMPLETE
FROM V$SESSION_LONGOPS
WHERE
TOTALWORK != 0
AND SOFAR != TOTALWORK
order by 1;

 

Thanks!

Advertisements

, ,

Leave a comment

Configuring Bidirectional Replication using Oracle® GoldenGate 12c

Hi Oracle Experts,

It has been a very long time since the last post, today, I will try to simplify the Oracle GoldenGate configurations for the bidirectional path setup between the homogeneous environments (Oracle to Oracle), I used the following products in the implementation:

  1. Oracle Solaris 11.2 SPARC (5.11)
  2. Oracle Database Enterprise Edition 12.1.0.2.0
  3. Oracle GoldenGate 12c for SPARC systems.

Please use the following table for your reference:

Source Hostname Oragg1 Target Hostname Oragg2
Source DB platform Oracle Database 12c Enterprise Edition Target DB platform Oracle Database 12c Enterprise Edition
Source DB version 12.1.0.2.0 Target DB version 12.1.0.2.0
Source DB Name Test1 Target DB Name Test2
Source OS Release Oracle Solaris 11.2 SPARC Target OS Release Oracle Solaris 11.2 SPARC
Source OS level (uname -r) 5.11 Target OS level (uname -r) 5.11
Source OGG Admin user Oggadm1 Target OGG Admin user Oggadm2
Source OS username ogguser, oracle Target OS username ogguser, oracle

1. Download and Install Software

The latest version of Oracle GoldenGate is always published in the Oracle Downloads page on Oracle Technology Network portal:

http://www.oracle.com/technetwork/middleware/goldengate/downloads/index.html.

It is a must to have the correct version that matches the operating system, database platform and version.

As a new feature for the installation starting from Oracle GoldenGate 12c, Oracle announced the graphical interface installation instead of the CLI in the previous versions.

For more information about the installation, please navigate to the latest Oracle GoldenGate Documentation:

http://docs.oracle.com/goldengate/1212/gg-winux/index.html.

2. Preparing the Source/Target databases:

  • For any Oracle database that will be a source or target and will be replicated using Oracle GoldenGate, it should be in the archive log mode:
SQL> SELECT log_mode FROM v$database;
LOG_MODE
------------
ARCHIVELOG

If the database isn’t in the archivelog mode, so it is the time to convert it by applying the following steps:

SQL> SELECT log_mode FROM v$database;
LOG_MODE
------------
NOARCHIVELOG
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 3340451840 bytes
Fixed Size                  2232960 bytes
Variable Size            1811942784 bytes
Database Buffers         1509949440 bytes
Redo Buffers               16326656 bytes
Database mounted.
SQL> ALTER DATABASE ARCHIVELOG; 
Database altered.
SQL> ALTER DATABASE OPEN; 
Database altered.
SQL> SELECT log_mode FROM v$database; 
LOG_MODE
------------
ARCHIVELOG


  • Make sure that the Oracle Redo Log files are set as world readable by executing the command “chmod +r *.log”.

Note: For all Source and Target servers, each source should be reachable to the target and vice versa through the network either by the hosts file or the DNS.

 

3. Configuring the Environment:

3.1 Configuring the Source/Target 12c databases

  • Verify that supplemental logging and forced logging are set properly.
SQL>SELECT force_logging, supplemental_log_data_min 
FROM v$database;
FOR SUPPLEME
--- --------
YES YES
  • The results should both be YES. If it is, then skip to the next step. If either result is NO, then following steps should be executed:
SQL> SELECT force_logging, supplemental_log_data_min 
FROM v$database;

FOR SUPPLEME
--- --------
NO  NO
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; 
Database altered.
SQL> ALTER DATABASE FORCE LOGGING; 
Database altered.
SQL> ALTER SYSTEM SWITCH LOGFILE; 
System altered.
SQL> SELECT force_logging, supplemental_log_data_min 
FROM v$database;

FOR SUPPLEME
--- --------
YES YES

  • Create the Oracle GoldenGate Administrator OGGADM1 on the source DB and grant dba role to this user.
SQL> CREATE USER oggadm1 IDENTIFIED BY ****;
User created.
SQL> GRANT dba TO oggadm1; 
Grant succeeded.
SQL> EXEC DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE (grantee=>'OGGADM1',privilege_type=>'capture',grant_select_privileges=>true, do_grants=>TRUE);
PL/SQL procedure successfully completed.


  • Create the Oracle GoldenGate Administrator OGGADM2 on the target DB and grant dba role to this user.
SQL> CREATE USER oggadm2 IDENTIFIED BY ****;
User created.
SQL> GRANT dba TO oggadm2; 
Grant succeeded.
SQL> EXEC DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE (grantee=>'OGGADM2',privilege_type=>'capture',grant_select_privileges=>true, do_grants=>TRUE);
PL/SQL procedure successfully completed.


3.2 Creating Startup files and Managers

  • Create the GLOBALS file on Source and Target hosts:

On the Source host:

$ vi GLOBALS 
-- add the following line:
CheckpointTable oggadm1.oggchkpt

On the target host:

vi GLOBALS
-- add the following line:
CheckpointTable oggadm2.oggchkpt

Note: Any change to the GLOBALS file requires a restart of GGSCI.

  • Create the optional startup.oby (Obey) file on Source and Target hosts in the Oracle GoldenGate installation directory, These are GGSCI commands that are done almost every time you start GGSCI, and they do not persist between sessions, so you will find yourself entering them many, many times, and therefore it is convenient to create a startup obey files, especially If you have several different databases or schemas that you login to on a regular basis, you may want to make startup01.oby, startup02.oby, startup03.oby, and so on.

On Source host:

$ vi startup.oby
-- Add the following lines to startup.oby
-- Startup Automatic file
DBLogin UserID oggadm1@TEST1, Password *****
Start Mgr
Info Mgr
Info CheckpointTable
Set Editor vi

On target host:

$ vi startup.oby
-- Add the following lines to startup.oby
-- Startup Automatic file
DBLogin UserID oggadm2@TEST2, Password *****
Start Mgr
Info Mgr
Info CheckpointTable
Set Editor vi

  • Create the Manager parameter (prm) file onthe source and target hosts under $OGG_HOME/dirprm
$ ./ggsci
GGSCI> edit param mgr
-- Add the following lines to mgr.prm
-- Manager process parameter file for Test1 host
PORT 7809
PurgeOldExtracts ./dirdat/*, UseCheckpoints

Note: If you did it correctly, GGSCI automatically adds the .prm extension and stores the file in the dirprm/ directory. If you wrongly add the extension yourself, GGSCI converts the filename to UPPERCASE and stores it in the installation directory which renders the file practically unusable.

On Source host:

GGSCI> obey startup.oby
GGSCI> -- Startup automatic file
GGSCI> DBLogin UserID oggadm1@TEST1, Password *****
Successfully logged into database.
GGSCI> Start Mgr
MGR is already running.
GGSCI> Info Mgr
Manager is running (IP port oragg1.7809, Process ID 11204).
GGSCI> Info CheckpointTable
No checkpoint table specified. Using GLOBALS specification (oggadm1.oggchkpt)...
Checkpoint table oggadm1.oggchkpt created 2015-11-12 12:05:19.
GGSCI> Set Editor vi
GGSCI> info all
Program     Status      Group       Lag at Chkpt  Time Since Chkpt
MANAGER     RUNNING

On Target host:

GGSCI> obey startup.oby
GGSCI> DBLogin UserID oggadm2@TEST2, Password ****
Successfully logged into database.
GGSCI> START MGR
MGR is already running.
GGSCI> INFO MGR
Manager is running (IP port oragg2.7810, Process ID 29487).
GGSCI> INFO CHECKPOINTTABLE
No checkpoint table specified. Using GLOBALS specification (oggadm2.oggchkpt)...
Checkpoint table oggadm.oggchkpt created 2015-11-12 12:06:44.
GSCI> Set Editor vi
GGSCI> info all
Program     Status      Group       Lag at Chkpt  Time Since Chkpt
MANAGER     RUNNING

3.3 Creating Checkpoint Tables on Source and Target hosts

On source host:

GGSCI> DBLogin UserID oggadm1@TEST1, Password *****
Successfully logged into database.
GGSCI> Add CheckpointTable

On Target host:

GGSCI> DBLogin UserID oggadm2@TEST2, Password ****
Successfully logged into database.
GGSCI> Add CheckpointTable

3.4 Extracting the database structure from Source DB to Target DB manually

  • Extract the structure of the tables from the source database using any external tool like SQL developer or TOAD; this will be used to create the target tables on the target Oracle 12c database as the DDL support is currently not configured for this OGG instance.

3.5Adding Transaction Data on Source and Schema Data on Target

  • On the source system, restart GGSCI and run Add TranData for the whole user schema used as a replication source of data
GGSCI> DBLogin UserID oggadm1@TEST1, Password ****
Successfully logged into database.
GGSCI> Add TranData schema.*

Note: Schema.* is referring for the source database that contains the actual data which should be mapped to the target database tables, if certain tables will only be extracted from the source database and replicated to the target database, so it should be hard coded in this command, ex: add trandata user1.table1

To check the added tables, please execute the following command:

GGSCI> info TranData schema_name.*
  • On the target system, login to the GGSCI console and add the schema data for the desired tables by executing the following commands:
GGSCI> DBLogin UserID oggadm2@TEST2, Password ****
GGSCI> Add SchemaTranData schema_name
GGSCI> info SchemaTranData schema_name

3.6 Creating the column definition for the source tables:

  • Create the column mapping from source to target tables using the OS utility, This utility is required if the tables have a different (heterogeneous) structure, but is still highly recommended even if the tables have the same (homogeneous) structure. If they do have the same structure, you may be able to use the AssumeTargetDefs parameter instead of the SourceDefs
GGSCI> DBLogin UserID oggadm1@TEST1, Password ****
Successfully logged into database.
GGSCI> edit param oratabs
-- Last update on 12112015
-- defgen column definitions for all PROD schemas
DefsFile dirdef/oratabs.def, Purge
UserID oggadm1@WEBPROD, Password oracle
-- REPLACE THE BELOW SECTION WITH THE ACTUAL SCHEMA/TABLE NAMES
Table schema.*;
--OR, if you are going to replicate specific tables, use:
Table schema, table_name;
  • From the OS level, execute the below command using ogguser OS user account and from the location of $OGG_HOME, this will generate a deff file which will be used by the target system:
#./defgen paramfile dirprm/oratabs.prm
  • Use the secure copy command to copy the generated file to the target dirdef directory:
# scp dirdef/oratabs.def ogguser@oragg2: /oradb01/ogg_home/product/12.1.2/dirdef/
Password: ****
oratabs.def                         100%  334KB 333.8KB/s   00:00

4. Configuring Data Capture using EXTRACT (Oracle to Oracle)

4.1 Configure Primary Extract (Source):

Extract/Replicat parameters are located under $OGG_HOME/dirprm, it can be modified either from the GGSCI console or from the OS editor; it should contain the following lines:

-- Primary Extract from TEST1 on oragg1 to TEST2 on oragg2
-- SETENV(ORACLE_SID = "TEST1")
Extract EXTXP01
ExtTrail ./dirdat/aa
UserID oggadm1@TEST1, Password *****
TranLogOptions ExcludeUser oggadm1
-- REPLACE THE BELOW SECTION WITH THE ACTUAL SCHEMA/TABLE NAMES
Table schema.*;
--OR, if you are going to replicate specific tables, use:
Table schema, table_name;
--Continue edit this file to append all required tables for extract

NOTE: the separator “;” is mandatory after each mentioned table in the extract parameter file, it will fail to extract the required data if it is not closing each table clause.

  • Add the primary extract and its ExtTrails using the following GGSCI commands:
GGSCI > Add Extract EXTXP01, TranLog, Begin Now
GGSCI > Add ExtTrail ./dirdat/aa, Extract EXTXP01

The primary Extract has been created and configured, but not started. Leave GGSCI running for the next step.

4.2 Configure DataPump (Source)

  • On the source host, use either the GGSCI console or the OS editor to create the EXTSE01.prm for the secondary extract.
-- Secondary Extract from TEST1 on oragg1 to TEST2 on oragg2
Extract EXTSE01
RmtHost oragg2, MgrPort 7810, Compress
RmtTrail ./dirdat/se
Passthru
-- Schema definition will be mentioned below
Table schema.table_name;

NOTE: the separator “;” is mandatory after each mentioned table in the extract parameter file, it will fail to extract the required data if it is not closing each table clause.

  • Add Exttrails and RMTTRAILS that will be used in the data pump operations:
GGSCI> Add Extract EXTSE01, ExtTrailSource ./dirdat/aa 
GGSCI> Add RmtTrail ./dirdat/se, Extract EXTSE01

5. Configuring Primary Data Delivery (Target)

Data delivery, also known as Replicat (the “e” is left off intentionally), is done at the target side. To configure data delivery, perform the following steps:

  • On target host, create the Replicat parameter file under $OGG_HOME/dirprm/:
$ vi REPPR01.rpm
-- Data Delivery (REPLICAT) from TEST1 on oragg1 to TEST2 on oragg2
Replicat REPPR01
UserID oggadm2@TEST2, password *****
AssumeTargetDefs
SourceDefs dirdef/oratabs.def
DiscardFile dirrpt/oratabs.dsc, Append
-- Schema definition will be mentioned below
Map schema_name.table_name, Target schema_name.table_name;
  • Add REPLICAT process using GGSCI console:
GGSCI> Add Replicat REPPR01, ExtTrail ./dirdat/se

This command will create the primary replication process which will be used for the data delivery from the source to the target.

  • Testing the Extract/Replicat processes by starting them using the GGSCI console:
  • On the source host:
GGSCI > start extract *
GGSCI > info extract *
  • On the target host:
GGSCI > start replicat *
GGSCI > info replicat *

Tip: at the time of running the extract and replicat process, always tail the ggserr.log file under $OGG_HOME to check the errors.

$ tail -100f ggserr.log

6. Configure Bidirectional Support

6.1 Configuring Extract on Target host

Execute the following commands using the ggsci console to create the extract processes on the target system:

GGSCI> Add Extract EXTPR01, TranLog, Begin Now
GGSCI> Add ExtTrail ./dirdat/bb, Extract EXTPR01
GGSCI> Add Extract EXTSEC01, ExtTrailSource ./dirdat/bb
GGSCI> Add RmtTrail ./dirdat/ra, Extract EXTSEC01

6.2 Configure Data Delivery on Source system

Execute the following commands using the ggsci console to create the replicat processes on the source system:

GGSCI> Add Replicat REPSE01, ExtTrail ./dirdat/ra

6.3  Starting All Services:

  • On source:
GGSCI> Start extract *
GGSCI> Start replicat *
  • On target:
GGSCI> start extract *
GGSCI> start replicat *

6.4 Viewing Reports

  • View the extract process reports while it is running on the source from the GGSCI console:
GGSCI> send extract EXTSE01, Report
Sending REPORT request to EXTRACT EXTSE01...
Request processed.
GGSCI> view report EXTSE01
  • View the replicat process reports while it is running on the target from the GGSCI console:
GGSCI> send replicat REPSE01, report
Sending REPORT request to REPLICAT REPSE01...
Request processed.
GGSCI> view report REPSE01

NOTE: The count of inserts/updates/deletes for the Replicat should match the number for the Extract. If there were any discards, they should be examined for the reason why they were discarded.

Leave a comment

2014 in review

The WordPress.com stats helper monkeys prepared a 2014 annual report for this blog.

Here’s an excerpt:

A San Francisco cable car holds 60 people. This blog was viewed about 1,000 times in 2014. If it were a cable car, it would take about 17 trips to carry that many people.

Click here to see the complete report.

Leave a comment

Database Cold Backup Script

Hello Everybody, I was trying to find a good OS Script to take a cold backup from the database without any human intervention, so I found some good stuff and I customized it on OEL linux 6.5, I believe it will work with the other linux flavors perfectly.

Basically, the script will take the backup into the same location of the script, and it can be added to the crontab jobs to run offline or in the weekends.

######################################
######################################
#Database Cold Backup Script     #####
# Author : mahmood.darweesh@gmail.com#
# Created : 18 Dec 2014    ###########
######################################
######################################
######################################


# ###########
# Description:
# ###########
echo
echo "==============================================="
echo "This script Takes a COLD BACKUP for a database."
echo "==============================================="

export TNS_ADMIN=/u01/app/oracle/product/11.2.0/dbhome_1/network/admin
export ORACLE_SID=test
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
DT=`date +%Y.%m.%d`
PFILE=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfile$ORACLE_SID.ora
echo Backup for $DT
echo "=============================================="
echo "Selecting the files that must be backed up...."
echo "=============================================="
/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus -S '/ as sysdba' <<EOFSQL
set termout off
set pages 0
set lines 120
set feedback off
set trimspool on
spool files.2.backup
select name from v\$datafile;
select name from v\$controlfile;
select member from v\$logfile;
spool off
! echo "======================================="
! echo "Shutting Down the database right now !!"
! echo "======================================="
shutdown immediate
exit;
EOFSQL
echo "=============================================================="
echo "Compressing the backup to the target location, please wait ..."
echo "=============================================================="
tar cfv /u01/app/oracle/bkp/ORACLE_HOME_$DT.tar $ORACLE_HOME
echo "==============================================================================================" 
echo "Compressing database files, logfiles, and control files to the target location, please wait..."
echo "=============================================================================================="
tar cfv /u01/app/oracle/bkp/ORADATA_$DT.tar $ORACLE_BASE/oradata
echo "=============================================="
echo "Starting the database immediately, stay tuned !!"
echo "=============================================="
/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus -S '/ as sysdba' <<EOFSQL
startup
exit;
EOFSQL
rm -rf files.2.backup
echo  "========================================================="
echo  "Database has been successfully backed up, have a nice day"
echo  "========================================================="

, , ,

Leave a comment

Enabling/Disabling Database Options in Enterprise Edition

This is a pure licensing post, but it is really important for DBAs to know how to do it in a correct way, and I hope it will be useful for all of you.

After installing a new 11.2 Enterprise Edition Database, you can disable the unlicensed option in the database like partitioning, advanced compression, Database Vault, Oracle Label Security, Oracle Data Mining and other options, So you need to follow the below steps to disable the unwanted options.

NOTE: you can deselect the unwanted options at the time of the installation by pressing the “Select Options” button, but still we have some options that we can not deselect like the Advanced compression option ACO.

db_03

To understand this topic, it is important to know where is the file that contains the information about all enabled options in your database, or simply query the database to know if the option is enabled or disabled.

The file that contains the status of components being enabled or disabled is:

$ORACLE_HOME/rdbms/lib/libknlopt.a

The relevant files contained within this archive and status’s associated with them are:

Automatic Storage Mgt ON=kfon.o
Automatic Storage Mgt OFF=kfoff.o

Context Management Text ON=kciwcx.o <<CTX is always enabled and cannot be disabled.

Oracle Data Mining ON=dmwdm.o
Oracle Data Mining OFF=dmndm.o

Oracle Database Vault ON=kzvidv.o
Oracle Database Vault OFF=kzvndv.o

Oracle OLAP ON=xsyeolap.o
Oracle OLAP OFF=xsnoolap.o

Oracle Label Security ON= kzlilbac.o
Oracle Label Security OFF= kzlnlbac.o

Oracle Partitioning ON=kkpoban.o
Oracle Partitioning OFF=ksnkkpo.o

Real Application Cluster ON=kcsm.o
Real Application Cluster OFF=ksnkcs.o

Oracle Real Application Testing ON=kecwr.o
Oracle Real Application Testing OFF=kecnr.o

Simply you can check if for example the partitioning feature has been enabled or disabled by executing the following command:

$ ar -t libknlopt.a | grep -c <filename> 
Product/Component Short Name <filename>
Automated Storage Management ASM kfon.o
Oracle Data Mining DM dmwdm.o
Database Vault DV kzvidv.o
Oracle OLAP OLAP xsyeolap.o
Oracle Label Security OLS kzlilbac.o
Oracle Partitioning PART kkpoban.o
Real Application Cluster RAC kcsm.o
Real Application Testing RAT kecwr.o

So, we are trying now to find if the partitioning option has been enabled or disabled by executing the below command:

[oracle@asmoracle lib]$ ar -t libknlopt.a | grep -c kkpoban.o
1

I am getting 0 if it has been disabled or 1 if it has been enabled, Starting with 11.2 and above there is a utility called ‘chopt’ that can be used in UNIX/LINUX and WINDOWS as well, another way to check if this option is already there or not by asking the database:

SQL> select * from v$option where parameter='Partitioning';

PARAMETER         VALUE
----------------- ------------------------------
Partitioning      TRUE

Shutdown the database and all started services in the same ORACLE_HOME, then Execute the chopt command to disable the partitioning option:

[oracle@asmoracle lib]$ chopt disable partitioning

Writing to /u01/app/oracle/product/11.2.0/dbhome_1/install/disable_partitioning.log...
/usr/bin/make -f /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk part_off ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
/usr/bin/make -f /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@asmoracle lib]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 24 03:04:43 2014

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size            2253784 bytes
Variable Size         1006636072 bytes
Database Buffers      637534208 bytes
Redo Buffers            7094272 bytes
Database mounted.
Database opened.
SQL> select * from v$option where parameter='Partitioning';
PARAMETER       VALUE
--------------- --------------------------------
Partitioning    FALSE

If we tried now to create any new partitioned table, it will raise the “ORA-00439: feature not enabled: Partitioning”

db_02

In 11.2 there are more feature that you can control and the “chopt” utility will be used in this case:

Product/Component Option
Oracle Data Mining dm
Database Vault dv
Oracle OLAP olap
Oracle Label Security lbac
Oracle Partitioning partitioning
Real Application Testing rat

References:

How to Check and Enable/Disable Oracle Binary Options (Doc ID 948061.1)

Common Questions on the Partitioning Option Installed in the Oracle Database (Licensing, Install, Remove) (Doc ID 1312416.1)

Oracle Database Installation Guide E48740-01

, , ,

10 Comments

Adding new disk to Virtual Machine for Oracle Enterprise Linux guests.

Today I will explain in few simple steps, how to add more space by adding more disks to the virtual machine, I am using VMware® Workstation 10 and the guest operating system will be Oracle Enterprise Linux 6.5.

Let’s have a quick look on the virtual machine configurations:

001_vmware_config

I have only 1 SCSI disk with 50GB of space, it contains the whole operating system, temp files, swap and all other files that required to run the operating system, in a few steps, I will add more 50 GB to the current virtual machine.

To add a new disk to the virtual machine, click on “Edit virtual machine settings” button, a pop up window will be displayed:

002_vm_settings

 

Click on “Hard Disk (SCSI)” then click on “Add” button, and choose the Hard Disk hardware to add it in the virtual machine, and click “Next” button

003_add_new_hdd

Choose the Disk Type from the next screen, it shows the IDE, SCSI and SATA, in our example I am going to choose the SCSI hard disk, we have the choice of creating an independent disk, but if a snapshot will be taken to virtual machine, the added disks will not be in sync with the snapshot, in this example, I will choose not to check the independent box and I will choose only the disk type “SCSI” and click Next:

004_disk_type

Whether you choose creating a new virtual disk or using an existing vmdk disk, it will work perfectly, I don’t have a prepared vmdk disk, so I will create a new one:

005_select_disk

Choose the size of the newly added hard disk, I’d reserved 50GB of disk space for this purpose, if you choose to allocate the new space immediately, and I recommend this option for some performance reasons, it will take longer time to be added and attached to the virtual machine, you have also the option to uncheck this option and reserve only the used space by this virtual machine disk, also you have the option to split this virtual disks to smaller segments 2GB for each, but this option will reduce the option because of the high IO while accessing the stored data inside these disks.

006_disk_capacity

Finally, choose the file location, the default location for the new disk will be inside the virtual machine folder:

007_disk_location

After clicking “Finish” button, a new disk can be seen in the virtual machine configuration area:

008_new_disk_added

A new disk had been added to the virtual machine, but it will take some more steps in order to add the reserved space to the guest operating system.

Power on the virtual machine to log in to the guest operating system using root user and check the new disk under /dev directory and starts with sd*, and it is marked with red color:

[root@template ~]# ls -ltrh /dev/sd*
brw-rw----. 1 root disk 8, 16 Sep 9 00:32 /dev/sdb
brw-rw----. 1 root disk 8, 0 Sep 9 00:32 /dev/sda
brw-rw----. 1 root disk 8, 4 Sep 9 00:32 /dev/sda4
brw-rw----. 1 root disk 8, 3 Sep 9 00:32 /dev/sda3
brw-rw----. 1 root disk 8, 6 Sep 9 00:32 /dev/sda6
brw-rw----. 1 root disk 8, 1 Sep 9 00:32 /dev/sda1
brw-rw----. 1 root disk 8, 5 Sep 9 00:32 /dev/sda5
brw-rw----. 1 root disk 8, 2 Sep 9 00:32 /dev/sda2

Partition the disk using fdisk command, the following guide is a simple explanation of the below command:

n > creating a new partition

p > the option to create a new primary partition

w > writing the changes to the disk

[root@template ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x364e8eb4.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u').

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-6527, default 1): <Accept the default by pressing ENTER>
Using default value 1
Last cylinder, +cylinders or +size{K,M,G}(1-6527,default 6527): <Accept the default by pressing ENTER>
Using default value 6527
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

Issue the command “ls -ltrh /dev/sd*” again, the new partition is there:

[root@template ~]# ls -ltrh /dev/sd*
brw-rw----. 1 root disk 8, 0 Sep 9 00:32 /dev/sda
brw-rw----. 1 root disk 8, 4 Sep 9 00:32 /dev/sda4
brw-rw----. 1 root disk 8, 3 Sep 9 00:32 /dev/sda3
brw-rw----. 1 root disk 8, 6 Sep 9 00:32 /dev/sda6
brw-rw----. 1 root disk 8, 1 Sep 9 00:32 /dev/sda1
brw-rw----. 1 root disk 8, 5 Sep 9 00:32 /dev/sda5
brw-rw----. 1 root disk 8, 2 Sep 9 00:32 /dev/sda2
brw-rw----. 1 root disk 8, 16 Sep 9 00:37 /dev/sdb
brw-rw----. 1 root disk 8, 17 Sep 9 00:37 /dev/sdb1 <<NEW DISK>>

 Format the disk using mkfs.ext4 command:

[root@template ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.43-WIP (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3276800 inodes, 13107024 blocks
655351 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
400 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

Create a new directory to mount the partition:

[root@template ~]# mkdir -p /u02

Check the current mount points using “df -h” command:

[root@template ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 17G 7.6G 8.6G 47% /
tmpfs 2.0G 72K 2.0G 1% /dev/shm
/dev/sda1 190M 54M 126M 31% /boot
/dev/sda5 3.9G 8.5M 3.7G 1% /tmp
/dev/sda2 24G 44M 23G 1% /u01

Mount the new partition to the operating system using “mount” command, then check the “df -h” command to verify the changes:

[root@template ~]# mount /dev/sdb1 /u02  --Mount command
[root@template ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 17G 7.6G 8.6G 47% /
tmpfs 2.0G 72K 2.0G 1% /dev/shm
/dev/sda1 190M 54M 126M 31% /boot
/dev/sda5 3.9G 8.5M 3.7G 1% /tmp
/dev/sda2 24G 44M 23G 1% /u01
/dev/sdb1 50G 52M 47G 1% /u02 -- The new mounted partition

Get the UUID number for the new disk by issuing the below command, the target disk /dev/sdb1 had been flagged by red mark:

[root@template ~]# ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx. 1 root root 10 Sep 9 00:32 5e0f1bcb-eb01-4edb-b504-a08502dbb251 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Sep 9 00:49 6d959a2c-6373-4b22-86bc-adb2f4af72b5 -> ../../sdb1 --
lrwxrwxrwx. 1 root root 10 Sep 9 00:32 73c1c05f-bb33-471f-88b0-25a1cf96f61a -> ../../sda6
lrwxrwxrwx. 1 root root 10 Sep 9 00:32 af38feca-d846-429f-9a41-c549b41f2f03 -> ../../sda3
lrwxrwxrwx. 1 root root 10 Sep 9 00:32 d41322c1-870d-4d26-8fb4-d5cc4c566bde -> ../../sda5
lrwxrwxrwx. 1 root root 10 Sep 9 00:32 f0efdaf2-3cfa-4ab9-b8a1-655e3c79056d -> ../../sda2

Mount the new partition permanently to the operating system by adding it to the /etc/fstab file, add the result of the previous command to the mentioned file with the same format of the file, this step is a mandatory step, otherwise, the “mount” command must be issued after each single reboot:

UUID=6d959a2c-6373-4b22-86bc-adb2f4af72b5      /u02         ext4    defaults    1     2

Thanks and good Luck !

, , ,

Leave a comment

Couldn’t use ASM storage due to password issue ORA-01017

Recently, I was trying to install a single Oracle Database Enterprise Edition 11.2.0.4 with ASM, everything completed successfully from the RAW device format to completing the installation and configuration of grid infrastructure and database software.

But when I started to create the database using the dbca tool, I got the following error:

Can not user ASM for database storage due to the following reason:
Could not connect to ASM due to the following error:
ORA-01017: invalid username/password; logon denied.

001_ASM_01017

Everyone will say there is a wrong provided password, this is also my thinking, but I found the ASMSNMP user is not created for some unknown reasons.

I did the below checks:

1. Created the password file for ASM again using orapwd utility and this doesn’t work at all.

002_ASM_PWD

2. As grid user, From sqlplus, I couldn’t connect using the ASMSNMP user account to the +ASM instance:

003_ASM_PWD

3. From asmcmd utility, I checked if ASMSNMP user account already exists:

[grid@asmoracle dbs]$ asmcmd
ASMCMD> lspwusr
Username sysdba sysoper sysasm
     SYS   TRUE    TRUE  FALSE

I found SYS user only, so we need now to create the ASMSNMP using the following commands:

* login to the +ASM instance using the SYSASM privilege:

SQL> create user asmsnmp identified by oracle;
User created.

SQL> grant sysdba to asmsnmp;
Grant succeeded.

* Back to ASMCMD, to check the asmsnmp user:

ASMCMD> lspwusr
Username sysdba sysoper sysasm
     SYS   TRUE    TRUE  FALSE
 ASMSNMP   TRUE   FALSE  FALSE

Try again, it works with me like wave !

,

4 Comments