Showing posts with label ASM. Show all posts
Showing posts with label ASM. Show all posts

Thursday, June 19, 2008

Create ASM environment for testing Purpose ( Dummy only Testing Purpose )

This is only for test case and not for production use..!!!
 We dont need any ASM Lib Drivers to be installed for this method...!!


For running a Single Instance ASM We need to have CSS Dameon to be a running before we create ASM. This will be invoked in the first
step when you try to create the ASM instance.


Now As a root user execute all these steps.

1. Create a directory asm_disks and
cd /u01/asm_disks

Start creating Logical Volumes ( LV ) inside the directory

[root@testserver]dd if=/dev/zero of=asm_disk1 bs=1024k count=1024
1024+0 records in
1024+0 records out

[root@testserver]dd if=/dev/zero of=asm_disk2 bs=1024k count=1024
1024+0 records in
1024+0 records out

[root@testserver]dd if=/dev/zero of=asm_disk3 bs=1024k count=1024
1024+0 records in
1024+0 records out

[root@testserver]dd if=/dev/zero of=asm_disk4 bs=1024k count=1024
1024+0 records in
1024+0 records out

and then

[root@testserver]losetup /dev/loop1 asm_disk1
[root@testserver]losetup /dev/loop2 asm_disk2
[root@testserver]losetup /dev/loop3 asm_disk3
[root@testserver]losetup /dev/loop4 asm_disk4
[root@testserver]raw -qa

[root@testserver]raw /dev/raw/raw1 /dev/loop1
/dev/raw/raw1: bound to major 7, minor 1

[root@testserver]raw /dev/raw/raw2 /dev/loop2
/dev/raw/raw2: bound to major 7, minor 2

[root@testserver]raw /dev/raw/raw3 /dev/loop3
/dev/raw/raw3: bound to major 7, minor 3

[root@testserver]raw /dev/raw/raw4 /dev/loop4
/dev/raw/raw4: bound to major 7, minor 4

[root@testserver]raw -qa
/dev/raw/raw1: bound to major 7, minor 1
/dev/raw/raw2: bound to major 7, minor 2
/dev/raw/raw3: bound to major 7, minor 3
/dev/raw/raw4: bound to major 7, minor 4

Assigb permission to oracle user :


[root@testserver]chmod 660 asm_disk*

[root@testserver]ls
asm_disk1 asm_disk2 asm_disk3 asm_disk4



[root@testserver]chown oracle:oinstall /dev/raw/raw1
[root@testserver]chown oracle:oinstall /dev/raw/raw2
[root@testserver]chown oracle:oinstall /dev/raw/raw3
[root@testserver]chown oracle:oinstall /dev/raw/raw4

Note : MAke sure you install Oracle Database Binaries ( Software only ) before you proceed

Now as a root user run the below command for start the CSS dameon.

[root@testserver]/u01/oracle/product/10.2.0/db_1/bin/localconfig add
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
testserver
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)

*******************************************************************

[root@testserver]ls /etc/oratab
/etc/oratab
[root@testserver]ls -ltr /etc/oratab
-rwxrw-r-- 1 oragrid root 881 Apr 29 02:40 /etc/oratab
[root@testserver]chown oracle:oinstall /etc/oratab


As Oracle User, Invoke DBCA












[root@testserver]ps -ef|grep ASM
oracle 8202 1 0 12:34 ? 00:00:00 asm_pmon_+ASM
oracle 8204 1 0 12:34 ? 00:00:00 asm_psp0_+ASM
oracle 8206 1 0 12:34 ? 00:00:00 asm_mman_+ASM
oracle 8208 1 0 12:34 ? 00:00:00 asm_dbw0_+ASM
oracle 8210 1 0 12:34 ? 00:00:00 asm_lgwr_+ASM
oracle 8212 1 0 12:34 ? 00:00:00 asm_ckpt_+ASM
oracle 8214 1 0 12:34 ? 00:00:00 asm_smon_+ASM
oracle 8216 1 0 12:34 ? 00:00:00 asm_rbal_+ASM
oracle 8218 1 0 12:34 ? 00:00:00 asm_gmon_+ASM
root 8240 7175 0 12:35 pts/2 00:00:00 grep ASM


Now you can go ahead and use your DBCA and create a database and on
step
6 of 13, you can use Automatic Storage management as your Filesystem.

Tuesday, May 27, 2008

Move Controlfile from Filesystem to Diskgroup

We
SQL> select name from v$controfile;

NAME
--------------------------------------------------------------------------------
/home/pwprd/ctl.ctl'

2. Shutdown the database and start the instance:
SQL> shutdown normal
SQL> startup nomount

3. Use RMAN to move the controlfile to ASM :
$ rman nocatalog
RMAN>connect target
RMAN>restore controlfile to '+DG NAME ' from 'FILE PATH';

e.g.

RMAN> restore controlfile to '+PWPRD_DATA' from '/home/pwprd/ctl.ct';

Monday, May 26, 2008

Creating an Oracle 10g database manually on ASM

Just for the understading of junior members in my present team..!!

Before Proceeding with Manual Database Creation Make sure you have the asm instance is running, Diskgroup is mounted and Sufficient space available for creating the database.

/home/oracle $ ps -ef | grep +ASM
oracle 25792 1 0 May25 ? 00:00:00 asm_pmon_+ASM

SQL> select group_number,name,state,total_mb/1024 TOTAL_GB,free_mb FREE_GB from v$asm_Diskgroup;

GROUP_NUMBER NAME STATE TOTAL_GB FREE_GB
------------ ------------------------------ ----------- ---------- ----------
1 DATA MOUNTED 4 2.5





Specifying the Instance's SID

The SID can be set through the ORACLE_SID environment variable.

export ORACLE_SID=ORCL

Creating the initialization parameter file

*.audit_file_dest='/u01/oracle/product/10.2.0/db_1/admin/orcl/adump'
*.background_dump_dest='/u01/oracle/product/10.2.0/db_1/admin/orcl/bdump'
*.compatible='10.2.0.1.0'
*.control_files='+DATA
*.core_dump_dest='/u01/oracle/product/10.2.0/db_1/admin/orcl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='test'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=200278016
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=536870912
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/oracle/product/10.2.0/db_1/admin/orcl/udump'
db_create_file_dest='+DATA'
log_archive_dest_1='LOCATION=+DATA'
db_create_online_log_dest_1='+DATA'

Note : Make sure you create the dump file directories( adump,udump,bdump,cdump)

Create Password File

Make sure you create the password file before you proceed with the instance startup.

Starting the instance

SQL*Plus: Release 10.2.0.1.0 - Production on Sat May 24 16:05:15 2008
 Copyright (c) 1982, 2004, Oracle.  All rights reserved.
SQL> connect sys/password as sysdba
Connected to an idle instance.

SQL*Plus tells us that we're connected to an idle instance. That means that it is not yet started. So, let's start the instance. We have to start the instance without mounting (nomount) as there is no database we could mount at the moment.

SQL> startup nomount pfile='/home/oracle/pfile.ora'
ORACLE instance started.
Total System Global Area 113246208 bytes
Fixed Size 787708 bytes
Variable Size 61864708 bytes
Database Buffers 50331648 bytes
Redo Buffers 262144 bytes

This created the SGA (System Global Area) and the background processes.

Creating the database

SQL>create database orcl
logfile group 1 ('+DATA') size 10M,
group 2 ('+DATA') size 10M,
group 3 ('+DATA') size 10M
character set WE8ISO8859P1
national character set utf8
datafile '+DATA' size 50M autoextend on next 10M maxsize unlimited extent management local
sysaux datafile '+DATA ' size 10M autoextend on next 10M maxsize unlimited
undo tablespace undo datafile '+DATA' size 10M
default temporary tablespace temp
tempfile '+DATA' size 10M;

If something goes wrong with the creation, Oracle will write an error into the alert log.

Completing the DB creation

In order to complete the db creation, the following scripts must be run as sys

SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql

SQL> connect system/manager
SQL> @?/sqlplus/admin/pupbld

After Creating set your asm environment and you can see all these files from asmcmd.

ASMCMD> ls
ARCHIVELOG/
CONTROLFILE/
DATAFILE/
ASMCMD> pwd
+DATA/ORCL
ASMCMD>


Suggestions and Corrections are welcome..!!!