Wish You and Families have Healthy, Happy, Prosperous and Wonderful.
The 10th Annual Hotsos Symposium is coming...
5 hours ago
This page contains my experiences and my thoughts about Oracle and etc... about IT. Perhaps With another way in my life.
$ ./crsstat -word dgSome disk groups... not registered in Grid. I had to register by manual, then I checked srvctl command-line, but no "add" diskgroup.
HA Resource Type Target State (Host)
----------- ------ ------ -----
ora.DISK00.dg ora.diskgroup.type ONLINE ONLINE on rhel5-test
$ sqlplus / as sysasm
SYS> alter diskgroup DISK01 mount;
Diskgroup altered.
SYS> alter diskgroup DISK02 mount;
Diskgroup altered.
SYS> alter diskgroup DISK03 mount;
Diskgroup altered.
$ ./crsstat -word dgBy the way, It's just fun today. Nothing special.
HA Resource Type Target State (Host)
----------- ------ ------ -----
ora.DISK00.dg ora.diskgroup.type ONLINE ONLINE on rhel5-test
ora.DISK01.dg ora.diskgroup.type ONLINE ONLINE on rhel5-test
ora.DISK02.dg ora.diskgroup.type ONLINE ONLINE on rhel5-test
ora.DISK03.dg ora.diskgroup.type ONLINE ONLINE on rhel5-test
Historically, when we created any database object—a table, an index, anything that consumed storage—the database would create the appropriate segments and allocate at least one initial extent. This extent might be small—say, 64K—but it was allocated.This(deferred_segment_creation) is (11gR2)initialization parameter help to save disk space and minimizes install time. (default=true)
SYS> create user demo identified by demo;When first row was inserted into the table, it needs segment (quota on tablespace).
User created.
SYS> grant create session, create table to demo;
Grant succeeded.
SYS> connect demo/demo
Connected.
DEMO> create table tb_demo (a number);
Table created.
DEMO> select segment_name,extent_id,bytes from user_extents order by segment_name;
no rows selected
DEMO> insert into tb_demo values(1);
insert into tb_demo values(1)
*
ERROR at line 1:
ORA-01950: no privileges on tablespace 'USERS'
DEMO> alter session set deferred_segment_creation=false;After changed "deferred_segment_creation value"=false, A "create table" situation needs segment...
Session altered.
DEMO> create table tb_demo2 (a number);
create table tb_demo2 (a number)
*
ERROR at line 1:
ORA-01950: no privileges on tablespace 'USERS'
SYS> alter user demo quota 10M on users;TB_DEMO2 table allocated segment, when created.
User altered.
DEMO> select segment_name,extent_id,bytes from user_extents order by segment_name;
no rows selected
DEMO> alter session set deferred_segment_creation=false;
Session altered.
DEMO> create table tb_demo2 (a number);
Table created.
DEMO> select segment_name,extent_id,bytes from user_extents order by segment_name;
SEGMENT_NAME EXTENT_ID BYTES
------------------------- ---------- ----------
TB_DEMO2 0 65536
1 row selected.
DEMO> select segment_name,extent_id,bytes from user_extents order by segment_name;TB_DEMO table allocated segment, after first row was inserted.
SEGMENT_NAME EXTENT_ID BYTES
------------------------- ---------- ----------
TB_DEMO2 0 65536
1 row selected.
DEMO> insert into tb_demo values(1);
1 row created.
DEMO> select segment_name,extent_id,bytes from user_extents order by segment_name;
SEGMENT_NAME EXTENT_ID BYTES
------------------------- ---------- ----------
TB_DEMO 0 65536
TB_DEMO2 0 65536
2 rows selected.
# useradd -d /opt/crfuser -s /bin/sh -g oinstall crfuser- Make "crfuser" user remote all nodes (but, i have only one node.)
# su - crfuser
$ unzip /tmp/crfpack-linux.zip
$ ssh-keygen -t rsa- Install and then enable tool all nodes
Generating public/private rsa key pair.
Enter file in which to save the key (/opt/crfuser/.ssh/id_rsa):
Created directory '/opt/crfuser/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /opt/crfuser/.ssh/id_rsa.
Your public key has been saved in /opt/crfuser/.ssh/id_rsa.pub.
The key fingerprint is:
28:dc:bd:69:d2:23:8f:44:0d:65:05:83:e3:10:50:6a crfuser@RHEL5-TEST
$ cat .ssh/id_rsa.pub >> .ssh/authorized_keys
$ ssh rhel5-test hostname
RHEL5-TEST
$ cd install
$ ./crfinst.pl -i rhel5-test -b /oracle/oracrfdb -m rhel5-test
Performing checks on nodes: "rhel5-test" ...
Generating cluster wide configuration file...
Creating a bundle for remote nodes...
Installing on nodes "rhel5-test" ...
Configuration complete on nodes "rhel5-test" ...
Please run "/opt/crfuser/install/crfinst.pl -f, optionally specifying BDB location with -bas root on each node to complete the install process. # /opt/crfuser/install/crfinst.pl -f
Installation completed successfully at /usr/lib/oracrf...
# /etc/init.d/init.crfd enable
# /etc/init.d/init.crfd status
OSysmond running with PID=17346.
OLoggerd running with PID=17455.
oproxyd running with PID=17462.
# ps -aef | grep oracrf
root 17345 17236 0 16:12 ? 00:00:00 /bin/sh /usr/lib/oracrf/bin/crfcheck
root 17346 17236 1 16:12 ? 00:00:00 /usr/lib/oracrf/bin/osysmond
root 17455 1 0 16:13 ? 00:00:00 /usr/lib/oracrf/bin/ologgerd -M -d /oracle/oracrfdb
crfuser 17462 1 0 16:13 ? 00:00:00 /usr/lib/oracrf/bin/oproxyd
# ls /oracle/oracrfdb/
crfalert.bdb crfconn.bdb crfhosts.bdb crfts.bdb __db.002 __db.004 __db.006 rhel5-test.ldb crfclust.bdb crfcpu.bdb crfloclts.bdb __db.001 __db.003 __db.005 log.0000000001
$ /usr/lib/oracrf/bin/oclumon -h
For help from command line : oclumon-h
For help in interactive mode :-h
Currently supported verbs are :
showtrail, showobjects, dumpnodeview, manage, version,debug, quit and help
$ /usr/lib/oracrf/bin/oclumon dumpnodeview
dumpnodeview: Node name not given. Querying for the local host----------------------------------------
Node: rhel5-test Clock: '12-17-09 09.20.28 UTC' SerialNo:434
----------------------------------------
SYSTEM:
#cpus: 2 cpu: 2.84 cpuq: 2 physmemfree: 18236 mcache:596736 swapfree: 2458264 ior: 0 iow: 121 ios: 7 netr: 27.21 netw: 26.87 procs: 252 rtprocs: 13 #fds: 4059 #sysfdlimit: 6815744 #disks: 1 #nics: 2 nicErrors: 0
TOP CONSUMERS:topcpu: 'osysmond(17346) 1.89' topprivmem: 'ocssd.bin(8077) 220036' topshm: 'ora_smon_orcl_1(20233) 68896' topfd: 'ocssd.bin(8077) 90' topthread: 'crsd.bin(2905) 58'
$ /usr/lib/oracrf/bin/oclumon dumpnodeview -v -n rhel5-test -last "00:00:10"
# ./crfinst.pl -g
Installation completed sucessfully at /usr/lib/oracrf...
# /usr/lib/oracrf/bin/crfgui -m rhel5-test
Cluster Health Analyzer V1.10
Look for Loggerd via node rhel5-test...Connected to Loggerd on rhel5-test
Note: Node rhel5-test is now up
Cluster 'MyCluster', 1 nodes. Ext time=2009-12-17 09:22:33
Making Window: IPD Cluster Monitor V1.10 on test01, Logger V1.03.20090322, Cluster "MyCluster" (View 0), Refresh rate: 1 sec
SQL> show parameter log_archive_dest_31
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_31 string
SQL> alter system set log_archive_dest_6='location=+disk02'
System altered.
SQL> alter system set log_archive_dest_11='location=+disk02'
alter system set log_archive_dest_11='location=+disk01'
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-16025: parameter LOG_ARCHIVE_DEST_11 contains repeated or conflicting attributes
I mention a book titled "Middleware Management with Oracle Enterprise Manager Grid Control 10g R5" written by Debu Panda(blog), Arvind Maheshwari ,they wrote an excellent Middleware Management with Oracle Enterprise Manager Grid Control 10g R5 Guide. This book is helpful to manage middleware and application configures on Enterprise Manager Grid.
Oracle 10g/11g Data and Database Management Utilities Book explains utility to optimize the efficiency, management, and performance of your daily database tasks.
SQL> create table tb (a number, b varchar2(100));Upon Table NOLOGGING, We use APPEND hint to use direct-path INSERT with the subquery syntax of the INSERT statement, that will generate a minimal number of redo log.
Table created.
SQL> insert /*+ APPEND_VALUES */ into tb values (1, 'ABCDEFG');
1 row created.
SQL> insert /*+ APPEND_VALUES */ into tb values (1, 'ABCDEFG');
insert /*+ APPEND_VALUES */ into tb values (1, 'ABCDEFG')
*
ERROR at line 1:
ORA-12838: cannot read/modify an object after modifying it in parallel
SQL> select * from v$version;start INSERT with the VALUES clause.
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 161
Next log sequence to archive 163
Current log sequence 163
SQL> create table tb_nologging (a number, b varchar2(100)) nologging;
Table created.
SQL> select table_name, logging from user_tables where table_name = 'TB_NOLOGGING';
TABLE_NAME LOG
------------------------------ ---
TB_NOLOGGING NO
SQL> @redo-newsession 2:
REDO_SIZE
----------
2004
SQL> insert into tb_nologging values (1, 'ABCDEFG');
1 row created.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 2004) REDO_SIZE
REDO_SIZE
----------
1880
SQL> @redo-new
REDO_SIZE
----------
3884
SQL> commit;
Commit complete.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 3884) REDO_SIZE
REDO_SIZE
----------
140
SQL> @redo-new
REDO_SIZE
----------
4024
SQL> insert into tb_nologging values (2, 'GFEDCBA');
1 row created.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 4024) REDO_SIZE
REDO_SIZE
----------
472
SQL> @redo-new
REDO_SIZE
----------
4496
SQL> commit;
Commit complete.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 4496) REDO_SIZE
REDO_SIZE
----------
140
SQL> @redo-newwe don't see the different redo log size between APPEND_VALUES hint and no hint, when insert on the same session again. but i see APPEND_VALUES hint generated redo log size more than no hint, after committed.(test another else...)
REDO_SIZE
----------
836
SQL> insert /*+ APPEND_VALUES */ into tb_nologging values (1, 'ABCDEFG');
1 row created.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 836) REDO_SIZE
REDO_SIZE
----------
888
SQL> @redo-new
REDO_SIZE
----------
1724
SQL> commit;
Commit complete.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 1724) REDO_SIZE
REDO_SIZE
----------
1200
SQL> @redo-new
REDO_SIZE
----------
2924
SQL> insert /*+ APPEND_VALUES */ into tb_nologging values (2, 'GFEDCBA');
1 row created.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 2924) REDO_SIZE
REDO_SIZE
----------
452
SQL> @redo-new
REDO_SIZE
----------
3376
SQL> commit;
Commit complete.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 3376) REDO_SIZE
REDO_SIZE
----------
1184
SQL> create table tb_logging (a number, b varchar2(100)) logging;On Table Logging... APPEND_VALUES hint generated many redo logs... (strange)
Table created.
SQL> @redo-new
REDO_SIZE
----------
1756
SQL> insert into tb_logging values (1, 'ABCDEFG');
1 row created.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 1756) REDO_SIZE
REDO_SIZE
----------
1880
SQL> @redo-new
REDO_SIZE
----------
3636
SQL> commit;
Commit complete.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 3636) REDO_SIZE
REDO_SIZE
----------
140
SQL> @redo-new
REDO_SIZE
----------
3776
SQL> insert /*+ APPEND_VALUES */ into tb_logging values (1, 'ABCDEFG');
1 row created.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 3776) REDO_SIZE
REDO_SIZE
----------
10508
SQL> @redo-new
REDO_SIZE
----------
14284
SQL> commit;
Commit complete.
SQL> @redo-diff;
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 14284) REDO_SIZE
REDO_SIZE
----------
1200
SQL> @redo-new
REDO_SIZE
----------
15484
SQL> insert into tb_logging values (1, 'ABCDEFG');
1 row created.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 15484) REDO_SIZE
REDO_SIZE
----------
592
SQL> @redo-new
REDO_SIZE
----------
16076
SQL> commit
2 ;
Commit complete.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 16076) REDO_SIZE
REDO_SIZE
----------
140
SQL> @redo-new
REDO_SIZE
----------
16216
SQL> insert /*+ APPEND_VALUES */ into tb_logging values (1, 'ABCDEFG');
1 row created.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 16216) REDO_SIZE
REDO_SIZE
----------
8508
SQL> @redo-new
REDO_SIZE
----------
24724
SQL> commit;
Commit complete.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 24724) REDO_SIZE
REDO_SIZE
----------
1200
SQL> create table tb1 nologging as select * from all_objects where 1=0;PL/SQL Scripts: a1=no hint, a2=APPEND_VALUES hint
Table created.
SQL> c/tb1/tb2
1* create table tb2 nologging as select * from all_objects where 1=0
SQL> /
Table created.
SQL> select table_name, logging from user_tables where table_name in ('TB1','TB2');
TABLE_NAME LOG
------------------------------ ---
TB1 NO
TB2 NO
SQL> @redo-newAPPEND_VALUES hint on Table NOLOGGING generated redo log less than NO hint.
REDO_SIZE
----------
3060
SQL> exec a1;
PL/SQL procedure successfully completed.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 3060) REDO_SIZE
REDO_SIZE
----------
6871852
SQL> @redo-new
REDO_SIZE
----------
6874912
SQL> exec a2(100);
PL/SQL procedure successfully completed.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 6874912) REDO_SIZE
REDO_SIZE
----------
956988
SQL> select count(*) from tb1;
COUNT(*)
----------
55796
SQL> select count(*) from tb2;
COUNT(*)
----------
55796
SQL> truncate table tb1;APPEND_VALUES hint on Table LOGGING generated redo log more than NO hint.
Table truncated.
SQL> truncate table tb2;
Table truncated.
SQL> alter table tb1 logging;
Table altered.
SQL> alter table tb2 logging;
Table altered.
SQL> select table_name, logging from user_tables where table_name in ('TB1','TB2');
TABLE_NAME LOG
------------------------------ ---
TB1 YES
TB2 YES
SQL> @redo-new
REDO_SIZE
----------
89088
SQL> exec a1;
PL/SQL procedure successfully completed.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 89088) REDO_SIZE
REDO_SIZE
----------
6869772
SQL> @redo-new
REDO_SIZE
----------
6958860
SQL> exec a2;
PL/SQL procedure successfully completed.
SQL> @redo-diff
old 1: select (value - &REDO_SIZE) REDO_SIZE
new 1: select (value - 6958860) REDO_SIZE
REDO_SIZE
----------
10107816