Oracle Database Experts

By Charles Kim

August 20th, 2007

Move SYS.AUD$ to another tablespace

DBATOOLS > cat audit_tablespace_view.sql

def fs=’&1′


– Need to pass the parameter of the file system to put the datafile

– Example would be @edba_audit_trail_report /u01

 

col db new_value v_db noprint

select name db

from v$database;

 

set markup html on spool on

spool audit_tablespace_&v_db..log

 

CREATE TABLESPACE SYSAUDIT_D DATAFILE

‘/&fs/oradata/&v_db/sysaudit_d_01.dbf’ SIZE 200m AUTOEXTEND OFF

LOGGING ONLINE PERMANENT

EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;

 

create table audx tablespace SYSAUDIT_D as select * from aud$ where 1 = 2;

 

rename AUD$ to AUD$$;

 

rename audx to aud$;

 

drop index i_aud1;

create index i_aud1 on aud$(sessionid, ses$tid) tablespace SYSAUDIT_D;

 


– And create a view that is worth something


CREATE OR REPLACE VIEW sys.edba_audit_trail_report (

os_username,

username,

terminal,

timestamp,

owner,

obj_name,

ses_actions,

alt,

aud,

com,

del,

gra,

ind,

ins,

loc,

ren,

sel,

upd,

ref,

exe,

Action )

AS

select /*+ rule */

spare1 /* OS_USERNAME */,

userid /* USERNAME */,

terminal /* TERMINAL */,

timestamp# /* TIMESTAMP */,

obj$creator /* OWNER */,

obj$name /* OBJECT_NAME */,

ses$actions /* SES_ACTIONS */,

substr(ses$actions,1,1),

substr(ses$actions,2,1),

substr(ses$actions,3,1),

substr(ses$actions,4,1),

substr(ses$actions,5,1),

substr(ses$actions,6,1),

substr(ses$actions,7,1),

substr(ses$actions,8,1),

substr(ses$actions,9,1),

substr(ses$actions,10,1),

substr(ses$actions,11,1),

substr(ses$actions,12,1),

substr(ses$actions,13,1),

act.name

from sys.aud$ aud,

system_privilege_map spm,

system_privilege_map spx,

STMT_AUDIT_OPTION_MAP aom,

audit_actions act

where aud.action# = act.action (+)

and – aud.logoff$dead = spm.privilege (+)

and aud.logoff$dead = aom.option# (+)

and – aud.priv$used = spx.privilege (+)

order by timestamp# desc,userid

 

/

 

grant select on sys.edba_audit_trail_report to rodba;

 

spool off

August 17th, 2007

Password Hacking in Oracle

 

Data Dictionary Views and Password Columns

There are numerous views and tables within the data dictionary that have a password column in clear text or in hashed form. The query below demonstrates that there are many ways to deriving the hash values for the user passwords. Once the hacker has the hashed value, the race is on to crack the hash value to determine the password to the database.

SQL> select owner, table_name from dba_tab_cols where column_name = ‘PASSWORD’;

 

OWNER TABLE_NAME

—————————— ——————————

SYS KU$_ROLE_VIEW

SYS KU$_USER_VIEW

SYS KU$_PSW_HIST_LIST_VIEW

SYS KU$_10_1_DBLINK_VIEW

SYS KU$_DBLINK_VIEW

SYS SCHEDULER$_CREDENTIAL

SYS EXU8PHS

SYS EXU8ROL

SYS DBA_USERS

SYS USER_DB_LINKS

SYS _BASE_USER

 

OWNER TABLE_NAME

—————————— ——————————

SYS USER_HISTORY$

SYS LINK$

SYS USER$

WKSYS WK$$HTTPAUTH

WKSYS WK$HTTPAUTH

WKSYS WK$_HTTPAUTH

SYSMAN MGMT_TEST_PROP

SYSMAN MGMT_BAM_DATA_HUBS

 

19 rows selected.

Oracle 11g stresses more than ever the need for tighter security. One of the best ways to thwart hacking is by enforcing a stronger security against Oracle’s data dictionary. Having access to the data dictionary should be on a need to have basis. DBAs should not grant the select any dictionary role or select catalog role to developers. If for some reason the developers need access to the data dictionary, only subsets of views should be considered for grants. When the request is made to have select privileges against any views with the password column, extra caution should be exercised since it makes it easier for hackers to attack the system. This is especially the case if strong passwords are not enforced.

August 13th, 2007

Data Guard Broker Setup

Data Guard Broker Preparation

Repeat these steps on both the primary and standby databases:

SQL> alter system set dg_broker_config_file1=’+DATA/dba11g/dba11g.dat’ scope=both;

System altered.

 

SQL> ALTER SYSTEM SET DG_BROKER_START=TRUE scope=both;

System altered.

 

Data Guard Broker Configuration

DBA11g > dgmgrl sys/oracle123

DGMGRL for Linux: Version 11.1.0.6.0 – Production

 

Copyright (c) 2000, 2005, Oracle. All rights reserved.

 

Welcome to DGMGRL, type “help” for information.

Connected.

DGMGRL> create configuration ‘DBA_DG’ as primary database is ‘DBA11g’ connect identifier is DBA11g.dbaexpert.com;

Configuration “DBA_DG” created with primary database “DBA11g”

DGMGRL> show configuration

 

Configuration

Name: DBA_DG

Enabled: NO

Protection Mode: MaxPerformance

Databases:

DBA11g – Primary database

 

Fast-Start Failover: DISABLED

 

Current status for “DBA_DG”:

DISABLED

 

DGMGRL> show configuration verbose;

 

Configuration

Name: DBA_DG

Enabled: NO

Protection Mode: MaxPerformance

Databases:

DBA11g – Primary database

 

Fast-Start Failover: DISABLED

 

Current status for “DBA_DG”:

DISABLED

DGMGRL> add database ‘DBA11gDR’ as connect identifier is DBA11gDR maintained as physical;

Database “DBA11gDR” added

DGMGRL> show configuration

 

Configuration

Name: DBA_DG

Enabled: NO

Protection Mode: MaxPerformance

Databases:

DBA11g – Primary database

DBA11gDR – Physical standby database

 

Fast-Start Failover: DISABLED

 

Current status for “DBA_DG”:

DISABLED

 

DGMGRL> show configuration verbose;

 

Configuration

Name: DBA_DG

Enabled: NO

Protection Mode: MaxPerformance

Databases:

DBA11g – Primary database

DBA11gDR – Physical standby database

 

Fast-Start Failover: DISABLED

 

Current status for “DBA_DG”:

DISABLED

 

DGMGRL> show configuration

 

Configuration

Name: DBA_DG

Enabled: NO

Protection Mode: MaxPerformance

Databases:

DBA11g – Primary database

DBA11gDR – Physical standby database

 

Fast-Start Failover: DISABLED

 

Current status for “DBA_DG”:

DISABLED

August 13th, 2007

Data Guard 11g Database Duplication Over Network Logfile

orapwd file=$ORACLE_HOME/dbs/orapwDBA11g entries=25 password=oracle123

DBA11gDR > ./dup.ksh

 

Recovery Manager: Release 11.1.0.6.0 – Production on Mon Aug 13 21:46:38 2007

 

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

 

RMAN>

connected to target database: DBA11G (DBID=231973368)

 

RMAN>

connected to auxiliary database: DBA11GDR (not mounted)

 

RMAN>

RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 23> 24> 25> 26> 27> 28> 29> 30> 31> 32>

using target database control file instead of recovery catalog

allocated channel: prmy1

channel prmy1: SID=110 device type=DISK

 

allocated channel: prmy2

channel prmy2: SID=132 device type=DISK

 

allocated channel: prmy3

channel prmy3: SID=111 device type=DISK

 

allocated channel: prmy4

channel prmy4: SID=109 device type=DISK

 

allocated channel: stby

channel stby: SID=98 device type=DISK

 

Starting Duplicate Db at 13-AUG-07

 

contents of Memory Script:

{

backup as copy reuse

file ‘/apps/oracle/product/11.1.0/DB/dbs/orapwDBA11g’ auxiliary format

‘/apps/oracle/product/11.1.0/DB/dbs/orapwDBA11gDR’ file

‘+DATA/dba11g/spfiledba11g.ora’ auxiliary format

‘/apps/oracle/product/11.1.0/DB/dbs/spfileDBA11gDR.ora’ ;

sql clone “alter system set spfile= ”/apps/oracle/product/11.1.0/DB/dbs/spfileDBA11gDR.ora””;

}

executing Memory Script

 

Starting backup at 13-AUG-07

Finished backup at 13-AUG-07

 

sql statement: alter system set spfile= ”/apps/oracle/product/11.1.0/DB/dbs/spfileDBA11gDR.ora”

 

contents of Memory Script:

{

sql clone “alter system set audit_file_dest =

”/apps/oracle/admin/DBA11gDR/adump” comment=

”” scope=spfile”;

sql clone “alter system set dispatchers =

”(PROTOCOL=TCP) (SERVICE=DBA11gDRXDB)” comment=

”” scope=spfile”;

sql clone “alter system set db_unique_name =

”DBA11gDR” comment=

”” scope=spfile”;

sql clone “alter system set db_file_name_convert =

”/DBA11g/”, ”/DBA11gDR/” comment=

”” scope=spfile”;

sql clone “alter system set log_file_name_convert =

”/DBA11g/”, ”/DBA11gDR/” comment=

”” scope=spfile”;

sql clone “alter system set control_files =

”/nfs02/oradata/DBA11gDR/control.ctl” comment=

”” scope=spfile”;

sql clone “alter system set log_archive_max_processes =

5 comment=

”” scope=spfile”;

sql clone “alter system set fal_client =

”DBA11gDR” comment=

”” scope=spfile”;

sql clone “alter system set fal_server =

”DBA11g” comment=

”” scope=spfile”;

sql clone “alter system set standby_file_management =

”AUTO” comment=

”” scope=spfile”;

sql clone “alter system set log_archive_config =

”dg_config=(DBA11g,DBA11gDR)” comment=

”” scope=spfile”;

sql clone “alter system set log_archive_dest_1 =

‘’service=DBA11g LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=DBA11g” comment=

”” scope=spfile”;

shutdown clone immediate;

startup clone nomount ;

}

executing Memory Script

 

sql statement: alter system set audit_file_dest = ”/apps/oracle/admin/DBA11gDR/adump” comment= ”” scope=spfile

 

sql statement: alter system set dispatchers = ”(PROTOCOL=TCP) (SERVICE=DBA11gDRXDB)” comment= ”” scope=spfile

 

sql statement: alter system set db_unique_name = ”DBA11gDR” comment= ”” scope=spfile

 

sql statement: alter system set db_file_name_convert = ”/DBA11g/”, ”/DBA11gDR/” comment= ”” scope=spfile

 

sql statement: alter system set log_file_name_convert = ”/DBA11g/”, ”/DBA11gDR/” comment= ”” scope=spfile

 

sql statement: alter system set control_files = ”/nfs02/oradata/DBA11gDR/control.ctl” comment= ”” scope=spfile

 

sql statement: alter system set log_archive_max_processes = 5 comment= ”” scope=spfile

 

sql statement: alter system set fal_client = ”DBA11gDR” comment= ”” scope=spfile

 

sql statement: alter system set fal_server = ”DBA11g” comment= ”” scope=spfile

 

sql statement: alter system set standby_file_management = ”AUTO” comment= ”” scope=spfile

 

sql statement: alter system set log_archive_config = ”dg_config=(DBA11g,DBA11gDR)” comment= ”” scope=spfile

 

sql statement: alter system set log_archive_dest_1 = ‘’service=DBA11g LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=DBA11g” comment= ”” scope=spfile

 

Oracle instance shut down

 

connected to auxiliary database (not started)

Oracle instance started

 

Total System Global Area 318054400 bytes

 

Fixed Size 1299624 bytes

Variable Size 96471896 bytes

Database Buffers 213909504 bytes

Redo Buffers 6373376 bytes

 

contents of Memory Script:

{

backup as copy current controlfile for standby auxiliary format ‘/nfs02/oradata/DBA11gDR/control.ctl’;

sql clone ‘alter database mount standby database’;

}

executing Memory Script

 

Starting backup at 13-AUG-07

channel prmy1: starting datafile copy

copying standby control file

output file name=/apps/oracle/product/11.1.0/DB/dbs/snapcf_DBA11g.f tag=TAG20070813T214752 RECID=3 STAMP=630539277

channel prmy1: datafile copy complete, elapsed time: 00:00:07

Finished backup at 13-AUG-07

 

sql statement: alter database mount standby database

RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.

 

contents of Memory Script:

{

set newname for tempfile 1 to

“+data”;

switch clone tempfile all;

set newname for datafile 1 to

“+data”;

set newname for datafile 2 to

“+data”;

set newname for datafile 3 to

“+data”;

set newname for datafile 4 to

“+data”;

set newname for datafile 5 to

“+data”;

set newname for datafile 6 to

“+data”;

backup as copy reuse

datafile 1 auxiliary format

“+data” datafile

2 auxiliary format

“+data” datafile

3 auxiliary format

“+data” datafile

4 auxiliary format

“+data” datafile

5 auxiliary format

“+data” datafile

6 auxiliary format

“+data” ;

sql ‘alter system archive log current’;

}

executing Memory Script

 

executing command: SET NEWNAME

 

renamed tempfile 1 to +data in control file

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

Starting backup at 13-AUG-07

channel prmy1: starting datafile copy

input datafile file number=00001 name=+DATA/dba11g/datafile/system.270.630497885

channel prmy2: starting datafile copy

input datafile file number=00002 name=+DATA/dba11g/datafile/sysaux.276.630497887

channel prmy3: starting datafile copy

input datafile file number=00005 name=+DATA/dba11g/datafile/example.268.630498257

channel prmy4: starting datafile copy

input datafile file number=00006 name=+DATA/dba11g/datafile/tools.280.630536173

output file name=+DATA/dba11gdr/datafile/example.259.630539237 tag=TAG20070813T214807 RECID=0 STAMP=0

channel prmy3: datafile copy complete, elapsed time: 00:00:46

channel prmy3: starting datafile copy

input datafile file number=00003 name=+DATA/dba11g/datafile/undotbs1.274.630497891

output file name=+DATA/dba11gdr/datafile/tools.258.630539237 tag=TAG20070813T214807 RECID=0 STAMP=0

channel prmy4: datafile copy complete, elapsed time: 00:00:47

channel prmy4: starting datafile copy

input datafile file number=00004 name=+DATA/dba11g/datafile/users.273.630497891

output file name=+DATA/dba11gdr/datafile/users.256.630539283 tag=TAG20070813T214807 RECID=0 STAMP=0

channel prmy4: datafile copy complete, elapsed time: 00:00:07

output file name=+DATA/dba11gdr/datafile/undotbs1.257.630539281 tag=TAG20070813T214807 RECID=0 STAMP=0

channel prmy3: datafile copy complete, elapsed time: 00:00:17

output file name=+DATA/dba11gdr/datafile/sysaux.260.630539237 tag=TAG20070813T214807 RECID=0 STAMP=0

channel prmy2: datafile copy complete, elapsed time: 00:02:25

output file name=+DATA/dba11gdr/datafile/system.261.630539237 tag=TAG20070813T214807 RECID=0 STAMP=0

channel prmy1: datafile copy complete, elapsed time: 00:02:35

Finished backup at 13-AUG-07

 

sql statement: alter system archive log current

 

contents of Memory Script:

{

switch clone datafile all;

}

executing Memory Script

 

datafile 1 switched to datafile copy

input datafile copy RECID=3 STAMP=630539391 file name=+DATA/dba11gdr/datafile/system.261.630539237

datafile 2 switched to datafile copy

input datafile copy RECID=4 STAMP=630539391 file name=+DATA/dba11gdr/datafile/sysaux.260.630539237

datafile 3 switched to datafile copy

input datafile copy RECID=5 STAMP=630539391 file name=+DATA/dba11gdr/datafile/undotbs1.257.630539281

datafile 4 switched to datafile copy

input datafile copy RECID=6 STAMP=630539391 file name=+DATA/dba11gdr/datafile/users.256.630539283

datafile 5 switched to datafile copy

input datafile copy RECID=7 STAMP=630539391 file name=+DATA/dba11gdr/datafile/example.259.630539237

datafile 6 switched to datafile copy

input datafile copy RECID=8 STAMP=630539391 file name=+DATA/dba11gdr/datafile/tools.258.630539237

Finished Duplicate Db at 13-AUG-07

 

sql statement: alter system set log_archive_config=”dg_config=(DBA11g,DBA11gDR)”

 

sql statement: alter system set log_archive_dest_1=’’service=DBA11gDR LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=DBA11gDR”

 

sql statement: alter system set log_archive_max_processes=5

 

sql statement: alter system set fal_client=DBA11g

 

sql statement: alter system set fal_server=DBA11gDR

 

sql statement: alter system set standby_file_management=AUTO

 

sql statement: alter system set log_archive_dest_state_1=enable

 

sql statement: alter system archive log current

 

allocated channel: stby

channel stby: SID=146 device type=DISK

 

sql statement: alter database recover managed standby database using current logfile disconnect

released channel: prmy1

released channel: prmy2

released channel: prmy3

released channel: prmy4

released channel: stby

August 13th, 2007

Script to export Discoverer Workbook from the Discoverer Repository

 

 

set serveroutput on size unlimited

set lines 32767 trims on pages 0 feed off head off ver off

spool /tmp/workbook.log

DECLARE

cursor c1 is

SELECT ‘/workbook “‘||docs.doc_name ||’”‘ wk

FROM EUL5_DOCUMENTS docs, EUL5_EUL_USERS users

WHERE users.eu_id = docs.doc_eu_id ;

v_text varchar(32000) :=  null;

v_text1 varchar(32000) := null;

v_text2 varchar(32000) := null;

v_text3 varchar(32000) := null;

v_text4 varchar(32000) := null;

v_text5 varchar(32000) := null;

v_text6 varchar(32000) := null;

v_text7 varchar(32000) := null;

v_text8 varchar(32000) := null;

v_text9 varchar(32000) := null;

v_counter number := 0;

 

v_max_length number := 8000;

v_command varchar2(1000) := ‘c:\oracle\BI\bin\dis51adm /connect d4osys/ea1sh2an3di4@sony /eul D4OSYS /export c:\temp\workbook’;

 

BEGIN

for r1 in c1 loop

– dbms_output.put_line(r1.wk);

v_text := v_text ||’ ‘|| r1.wk;

 

if length(v_text) > v_max_length then

  if v_counter = 0 then

    v_text1 := v_text;

    dbms_output.put_line(v_command||v_counter||’.eex’||v_text1);

  elsif v_counter = 1 then

    v_text2 := v_text;

    dbms_output.put_line(v_command||v_counter||’.eex’||v_text2);

  elsif v_counter = 2 then

    v_text3 := v_text;

    dbms_output.put_line(v_command||v_counter||’.eex’||v_text3);

  elsif v_counter = 3 then

    v_text4 := v_text;

    dbms_output.put_line(v_command||v_counter||’.eex’||v_text4);

  elsif v_counter = 4 then

    v_text5 := v_text;

    dbms_output.put_line(v_command||v_counter||’.eex’||v_text5);

  elsif v_counter = 5 then

    v_text6 := v_text;

    dbms_output.put_line(v_command||v_counter||’.eex’||v_text6);

  elsif v_counter = 6 then

    v_text7 := v_text;

    dbms_output.put_line(v_command||v_counter||’.eex’||v_text7);

  elsif v_counter = 7 then

    v_text8 := v_text;

    dbms_output.put_line(v_command||v_counter||’.eex’||v_text8);

  elsif v_counter = 8 then

    v_text9 := v_text;

    dbms_output.put_line(v_command||v_counter||’.eex’||v_text9);

  end if;

  v_text := NULL;

  v_counter := v_counter + 1;

end if;

 

end loop;

/*

dbms_output.put_line(‘Length v_text: ‘||length(v_text));

dbms_output.put_line(‘Length v_text1: ‘||length(v_text1));

dbms_output.put_line(‘Length v_text2: ‘||length(v_text2));

dbms_output.put_line(‘Length v_text3: ‘||length(v_text3));

dbms_output.put_line(‘Length v_text4: ‘||length(v_text4));

dbms_output.put_line(‘Length v_text5: ‘||length(v_text5));

dbms_output.put_line(‘Length v_text6: ‘||length(v_text6));

dbms_output.put_line(‘Length v_text7: ‘||length(v_text7));

dbms_output.put_line(‘Length v_text8: ‘||length(v_text8));

dbms_output.put_line(‘Length v_text9: ‘||length(v_text9));

*/

 

dbms_output.put_line(‘c:\oracle\BI\bin\dis51adm /connect d4osys/ea1sh2an3di4@sony /eul D4OSYS /export c:\temp\workbook.eex ‘||v_text);

 

end;

/

spool off

 

Documented By:

Charles

Oracle Database Administration

Oracle RAC DBA

http://www.dbaexpert.com

August 13th, 2007

ASM for non-RAC

In Oracle 10g, this is the output:

cd $ORACLE_HOME/bin

[root@rac103 ASM]# cd bin
[root@rac103 bin]# localconfig add
-bash: localconfig: command not found
[root@rac103 bin]# ls -lt *local*
-rwxr-xr-x 1 oracle oinstall 21991 Aug 12 16:21 localconfig
[root@rac103 bin]# ./localconfig add
/etc/oracle does not exist. Creating it now.
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 90 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.
rac103
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)

Now, let’s configure ASM:

August 12th, 2007
August 12th, 2007

Start FTP on Redhat

service vsftpd start

August 11th, 2007

Setup Oracle ASMLIB

FDISK Output

[root@rac103 ~]# fdisk -l

Disk /dev/hda: 82.3 GB, 82348277760 bytes

240 heads, 63 sectors/track, 10637 cylinders

Units = cylinders of 15120 * 512 = 7741440 bytes

Device Boot Start End Blocks Id System

/dev/hda1 * 1 1354 10236208+ 83 Linux

/dev/hda2 1355 6772 40960080 83 Linux

/dev/hda3 6773 7043 2048760 82 Linux swap

/dev/hda4 7044 10637 27170640 5 Extended

/dev/hda5 7044 7314 2048728+ 83 Linux

/dev/hda6 7315 8348 7817008+ 83 Linux

/dev/hda7 8349 9382 7817008+ 83 Linux

/dev/hda8 9383 10416 7817008+ 83 Linux

Change permission for disks

[root@rac103 ~]# cd /dev

[root@rac103 dev]# chown oracle:oinstall /dev/hda6

[root@rac103 dev]# chown oracle:oinstall /dev/hda7

[root@rac103 dev]# chown oracle:oinstall /dev/hda8

Configure ASM

[root@rac103 dev]# cd /etc/init.d

[root@rac103 init.d]# ls -l oracle*

-rwxr-xr-x 1 root root 18114 Oct 24 2006 oracleasm

[root@rac103 init.d]# ./oracleasm configure

Configuring the Oracle ASM library driver.

 

This will configure the on-boot properties of the Oracle ASM library

driver. The following questions will determine whether the driver is

loaded on boot and what permissions it will have. The current values

will be shown in brackets (‘[]‘). Hitting <ENTER> without typing an

answer will keep that current value. Ctrl-C will abort.

 

Default user to own the driver interface []: oracle

Default group to own the driver interface []: oinstall

Start Oracle ASM library driver on boot (y/n) [n]: y

Fix permissions of Oracle ASM disks on boot (y/n) [y]:

Writing Oracle ASM library driver configuration: [ OK ]

Loading module “oracleasm”: [ OK ]

Mounting ASMlib driver filesystem: [ OK ]

Scanning system for ASM disks: [ OK ]

[root@rac103 init.d]#

[root@rac103 init.d]# ./oracleasm

Usage: ./oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}

[root@rac103 init.d]# ./oracleasm createdisk DATA1 /dev/hda6

Marking disk “/dev/hda6″ as an ASM disk: [ OK ]

[root@rac103 init.d]# ./oracleasm createdisk DATA2 /dev/hda7

Marking disk “/dev/hda7″ as an ASM disk: [ OK ]

[root@rac103 init.d]# ./oracleasm createdisk FRA1 /dev/hda8

Marking disk “/dev/hda8″ as an ASM disk: [ OK ]

[root@rac103 init.d]# ./oracleasm listdisks

DATA1

DATA2

FRA1

[root@rac103 init.d]# ./oracleasm querydisk DATA1

Disk “DATA1″ is a valid ASM disk on device [3, 6]

[root@rac103 init.d]# ./oracleasm querydisk DATA2

Disk “DATA2″ is a valid ASM disk on device [3, 7]

[root@rac103 init.d]# ./oracleasm querydisk FRA1

Disk “FRA1″ is a valid ASM disk on device [3, 8]

[root@rac103 init.d]# ./oracleasm listdisks

DATA1

DATA2

FRA1

[root@rac103 init.d]# ./oracleasm scandisks

Scanning system for ASM disks: [ OK ]

[root@rac103 init.d]# ./oracleasm stop

Unmounting ASMlib driver filesystem: [ OK ]

Unloading module “oracleasm”: [ OK ]

[root@rac103 init.d]# ./oracleasm start

Loading module “oracleasm”: [ OK ]

Mounting ASMlib driver filesystem: [ OK ]

Scanning system for ASM disks: [ OK ]

 

Now start CSS for non-RAC ASM
cd $ORACLE_HOME/bin

[root@rac103 bin]# ./localconfig add

/etc/oracle does not exist. Creating it now.

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 90 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.

rac103

CSS is active on all nodes.

Oracle CSS service is installed and running under init(1M)

 

Listdisks and Querydisk

[root@rac103 init.d]# /etc/init.d/oracleasm listdisks

DATA1

DATA2

FRA1

[root@rac103 init.d]# /etc/init.d/oracleasm querydisk /dev/hda6

Disk “/dev/hda6″ is marked an ASM disk with the label “DATA1″

[root@rac103 init.d]# /etc/init.d/oracleasm querydisk /dev/hda7

Disk “/dev/hda7″ is marked an ASM disk with the label “DATA2″

[root@rac103 init.d]# /etc/init.d/oracleasm querydisk /dev/hda8

Disk “/dev/hda8″ is marked an ASM disk with the label “FRA1″

 

Resetting CSS to new oracle home

[root@rac103 bin]# ./localconfig reset /apps/oracle/product/11.1.0/ASM

Successfully accumulated necessary OCR keys.

Creating OCR keys for user ‘root’, privgrp ‘root’..

Operation successful.

Configuration for local CSS has been initialized

Stale CSS daemon is running… killing it now

Cleaning up Network socket directories

Setting up Network socket directories

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.

Cluster Synchronization Services is active on these nodes.

rac103

Cluster Synchronization Services is active on all the nodes.

Oracle CSS service is installed and running under init(1M)

 

Manually Cleaning up CSS

[root@rac103 bin]# ./localconfig delete

Stopping Cluster Synchronization Services.

Shutting down the Cluster Synchronization Services daemon.

Shutdown request successfully issued.

Shutdown has begun. The daemons should exit soon.

Cleaning up Network socket directories

[root@rac103 bin]# ps -ef |grep -i css

root 6477 6288 0 18:25 pts/2 00:00:00 grep -i css

[root@rac103 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

 

Cleaning up Network socket directories

Setting up Network socket directories

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.

Cluster Synchronization Services is active on these nodes.

rac103

Cluster Synchronization Services is active on all the nodes.

Oracle CSS service is installed and running under init(1M)

August 11th, 2007

Redhat Linux Setup

Create Oracle User:

# groupadd oinstall
# groupadd dba
# mkdir -p /home/oracle /ocfs
# useradd -d /home/oracle -g oinstall -G dba -s /bin/ksh oracle
# chown oracle:dba /export/home/oracle /apps
# echo "oracle123" |passwd oracle
passwd: password successfully changed for oracle
Setup /etc/profile
if [ $USER = "oracle" ]; then            
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384                        
    ulimit -n 65536            
  else                        
  ulimit -u 16384 -n 65536            
  fi
fi

/etc/pam.d/login
session required /lib/security/pam_limits.so

 

/etc/security/limits.conf

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
/etc/sysctl.conf
kernel.shmall                = 2097152
kernel.shmmax                = 2147483648
kernel.shmmni                = 4096
kernel.sem                   = 250 32000 100 128
fs.file-max                  = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default        = 1048576
net.core.rmem_max            = 1048576
net.core.wmem_default        = 262144
net.core.wmem_max            = 262144

FOR COMPLETE step by step shell scripts, please consult the DBAExpert.com website:  http://dbaexpert.com/linux/

				
August 11th, 2007

Mount NFS

On the server: 
First, modify /etc/exports
         #
         # /etc/exports for DBAExpert.com
         #
         /apps/oracle/11g rac101.dbaexpert.com(rw) \
                          rac11.dbaexpert.com

Start the NFS Server processes
service nfs start

On the client, mount the share:
First, create the directory for 11g (as in this example).  Next, mount the file system:
mount rac1:/apps/oracle/11g /11g

				
August 9th, 2007

Read NTFS from Linux (dual boot)

You have to download ntfs kernel module. Maybe you can find it at
rpm.livna.org. The file name is something like kernel-ntfs-version.arch.rpm.

# rpm -ivh kernel-ntfs-version.arch.rpm

To mount ntfs partition

# mount -t ntfs /dev/hdx /any/dir/you/create

Unfortunately, ntfs support is currently read only. Read write support is
experimental and you can use it at your own risk. To activate read write
ntfs support, you must install kernel source code and configure it.

|