ASM Command-line (ASMCMD) Utility

ASMCMD is a comman-line utility that helps us to view,manage,manipulate,perform search,display space utilization of files and directories within ASM disk groups.

Can ASMCMD be used to manipulate the disks in a disk group?

No. We can’t use ASMCMD to manipulate disks in a disk group. Manipulation includes operations such as addition and deletion of disks in a disk group/creating and dropping of disk groups. We can use SQL commands for that purpose.

What is a system-generated filename?

A system-generated file name is also called as fully qualified filename.

Every file created in ASM gets this system-generated name.

This is same as the complete path name in normal file system.(say $ORACLE_HOME=/u01/app/product/oracle/…)

Does fully qualified filename/system generated filename follow any standard?

Yes.Fully qualified filename follows the following standard:

+diskGroupName/databaseName/fileType/fileTypeTag.fileNumber.incarnation

Example:

+dgroup6/sample/CONTROLFILE/Current.256.541952343

In this example,
dgroup6 – diskgroup
sample – database
CONTROLFILE – type of file
current – file type tag
256 – file number
541952343 – incarnation

ASMCMD supports only forward slash().

Filenames are not case sensitive.

What is an ASM directory?

An ASM directory is a container of files.It is same as directories in file system.An ASM directory is autogenerated.A plus sign(+) represents a root directory.A fully qualifiedname or a system-generated name represents a hierarchy of directories.

An ASM automatically generates directories for files in fully qualified name and these directories are called as system-generated directories.

Following ASM commands can be used to manage these directories:
cd – move up and down between these directories
pwd – prints the name of the current directory
ls – lists the contents of the current directory
mkdir – We can create our own directories as sub-directories of system-generated directories(Note:ALTER DISKGROUP command can be used for the same purpose)
mkalias – create file alias

An ASM directory can be a part of the tree structure of other directories.

What is the use of -p option of ASMCMD?

We can start ASMCMD with -p option(ASMCMD -p) to include current directory as a part of ASMCMD prompt.

What is an alias?

Aliases are filenames that are pointers or references to system-generated filenames.They are user-friendly and are same as symbolic names in UNIX/Linux.They are used to simplify filename administration.Following commands can be used to create aliases:

mkalias,ALTER DISKGROUP with ADD ALIAS clause :

Syntax:

ALTER DISKGROUP dgroup1 ADD ALIAS ‘(aliasname)’
FOR ‘(system-generated filename of file)’;

We can create alias:

1) At system-generated subdirectory
2) At user-generated subdirectory
3) At disk group level

An alias name has at minimum diskgroup as a part of its filename.

To get the system-generated file name and its alias use the following ASMCMD command: 

ls -l

What is the difference between absolute path and relative path?

An absolute path is the system-generated filename that starts from the name of a diskgroup(+).A relative pathname specifies path relative to present working directory.Say a user is in diskgroup(+dgroup1),the relative path can be sample/CTLFILE/CURRENT.123.2345678.

What is a pseudo-directory?

A pseudo-directory is a name that can be specified along with the cd command. They are:
. – current working directory (single-dot)
.. – parent directory of the current directory(two dots without space)

What is a wildcard character?

The characters ‘*’ and ‘%’ are referred to as wildcard characters that match zero or more characters within an absolute or relative path ,which saves typing of full directory or filename.Both these characters behave identically.ASMCMD commands that accept wildcard characters are cd, du, find, ls, lsdsk, and rm.

Free Oracle Database Articles, Tips, Jobs :

Delivered by FeedBurner

Oracle ASM(Automatic Storage Manager) instance Creation

ASM instance is used to manage database files.If a node hosts multiple databases,single database,files can be managed using ASM.Two possible ASM deployments are:
1) Seperate oracle home is there are multiple databases on a single node
2) No seperate oracle home if the node hosts a single database.
ASM instance needs to be created and started before the Oracle database instance is started.
css – cluster synchronization service daemon is used to establish connection between an ASM instance and oracle database instance.
To startup ASM instance alone and restrict the connection to Oracle database instance startup ASM instance as follows:
SQL>STARTUP RESTRICT;
Steps to startup an ASM instance are as follows:
1) Check is css is running using
ps -efgrep css
We can also use crsctl command to check if css appears healthy
crsctl check css
If css isn’t up and running startup ASM as follows
1) Login as root user
2) export PATH=PATH:$ORACLE_HOME
3) localconfig add
The localconfig command creates /etc/oracle file,startsup css.The $ORACLE_HOME/css/admin has control script for css startup and shutdown.
It adds init.cssd to /etc/inittab file.If we use DBCA to create an instance css is started automatically.
2) Create a initialization parameter file initasm+.ora with the following parameters set.
Instance_type=+ASM
ASM_POWER_Limit =Value from 1 to 11
ASM_Diskstring = ‘/dev/sda*’,
ASM_DISKGROUPS=dg1,dg2
3) Startup the instance.ASM doesn’t have a data dictionary.It is mandatory to login as a user with SYSDBA/SYSOPER privilege.
For local authentication use Operating system(OS) authentication.
For remote authentication use a password file.
4) Set ORACLE_SID=+ASM (ASM is the default value).The value set for instance_type is mapped internally to db_unique_name.
$sqlplus / nolog
SQL>connect / as sysdba
SQL> startup pfile=’/asd/initasm+.ora’
This step creates an ASM instance.ASM cache is the SGA component specific to ASM.It takes as little as 25MB- 30MB space.Total spce needed for an ASM instance is 100MB as it doesnt have any datafiles.
5) Check is ASM instance is up and running using :
ps -efgrep asm
The step above lists background processes like:
asm_pmon_+asm
asm_smon_+asm
asm_lgwr_+asm
asm_ckpt_+asm
asm_dbw0_+asm
asm_mman_+asm
Few special is ASM like
asm_rbal_+asm
asm_psp0_+asm
asm_gmaon_+asm
Mount Command From ASM Instance:
We installed ASM instance in our testlab and we were doing some experiments.Mentioned below are few interesting errors that helps us understand ASM better.
SQL> select * from v$datafile;
select * from v$datafile *ERROR at line 1:ORA-01507: database not mounted
SQL> alter database mount;
alter database mount*ERROR at line 1:ORA-15000: command disallowed by current instance type

Free Oracle Database Articles, Tips, Jobs :

Delivered by FeedBurner

Oracle Database 12c RMAN to backup container, pluggable databases

Why do we backup database?
Backup involves making copies of the database to re-create the database if necessary. This is used to avoid loss of data.They form the basis of recovery
Plan for backup
Consistently check and verify backups to make sure they’re correct and usable during a recovery. This can be achieved by performing regular review of database corruption
Backup involves keeping copies of Oracle database files – data files, control file and archived redo log file
Tape storage is the cheaper way to store large amount of data offsite
Oracle database 12c offers unique opportunity to backup pluggable, non-pluggbale(container) databases using RMAN. Here is a simple overview of performing backup of oracle database 12c
1) While we connect to container database, as a user containing sysbackup or sysdba privilege perform backup of root, pluggable databases, archived redo logs as follows
backup database;
2) To perform backup of root database issue the following command as an user containing sysbackup or sysdba privilege
backup database root;
3) To perform backup of pluggable databases, connect to pluggable database as a local user containing sysbackup or sysdba privilege
This is visible only to that pluggable database and root
backup database; – This will not backup the archived redo logs
Oracle RMAN Backup Encryption:
Security is gaining importance. As per the reports in the year 2008, loss of confidential information has increased  to 63%. This loss of confidential information is a breach of Service Level Agreement (SLA). Organizations will have to compensate these loses in the form of financial penalties.
A recent information protection law from a state in U.S.A claims that information of residents of this state stored in databases across the globe will have to be encrypted. Upon failure, the database owners will have to pay $5000 penalty. These kind of laws demand a robust database architecture.
Apart from design stage, loss of valuable information happens while the DBA does some administrative tasks including cloning production instances to create development, test instances. During such tasks critical information including credit card details, health records, SSN etc gets exposed. These information need to be in encrypted fashion. To decrypt it password needs to be supplied.
This concept of encryption/decryption can be extended to Oracle RMAN (recovery manager) backup and recovery. The information needs to be encrypted using AES which encrypts data in 128,192,256 bits. It is necessary to set the encryption algorithm and supply password during recovery
RMAN> set encryption algorithm ‘aes256’ identified by pass;
executing command: SET encryption
using target database control file instead of recovery catalog
RMAN> backup as compressed backupset database format ‘C:apporacle_backup_encryption.bkp’;
Starting backup at 11-MAY-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
…..
RMAN> set decryption identified by pass;

Free Oracle Database Articles, Tips, Jobs :

Delivered by FeedBurner

Forcelogging Nologging Oracle Dataguard 11g

The first step in creating the standby database, physical standby database is to enable force logging. By enabling this every transaction and detailed logging happens in online redo log file. Dataguard is based on the concept of redo apply that guarantees transactionally consistent database. For this to happen detailed logging at primary database is needed and hence if the database is in Nologging mode we need to enable force logging.

To get to know the status of force logging, look at v$database view

select force_loggin from v$database; – If enabled this displays yes if not displays No.

As per Oracle database 11g documentation we can have one primary database and upto 9 standby database in a physical standby database configuration

Free Oracle Database Articles, Tips, Jobs :

Delivered by FeedBurner