--
select * from v$rman_configuration
This site contains information, scripts and instructions related to Oracle database and other technologies. Please use sqlplus and test my scripts on test environment before actual use on production. All relevant comments are welcome.
Страницы
- Main
- Veritas cluster
- AIX
- Solaris
- Linux
- Performance scripts
- RAC
- TNS
- Init parameters
- Dataguard
- ASM
- Unix tips
- VxVM
- Linux HA (hearbeat)
- Oracle internals
- Metalink (useful notes)
- Security
- OGG Oracle Golden Gate
- HTML/JavaScript in sqlplus
- Automatic TSPITR 11.2.0.3 (dropped user)
- 12.1
- SQL Performance Analyzer
- Backup/Recovery
- Alert log
четверг, 6 января 2011 г.
вторник, 4 января 2011 г.
asm: mount diskgroup
05:18:16 40 4294967295 SYS@+asm> alter diskgroup data dismount;
Diskgroup altered.
Elapsed: 00:00:00.18
05:21:33 40 4294967295 SYS@+asm> alter diskgroup data mount;
Diskgroup altered.
Diskgroup altered.
Elapsed: 00:00:00.18
05:21:33 40 4294967295 SYS@+asm> alter diskgroup data mount;
Diskgroup altered.
Listener: password protected?
--
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 04-JAN-2011 04:59:28
Uptime 0 days 0 hr. 0 min. 18 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File C:\oracle\product\10.2.0\db_3\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC210881539119)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> change_password
Old password:
New password:
Reenter new password:
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Password changed for LISTENER
The command completed successfully
--
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 04-JAN-2011 04:59:28
Uptime 0 days 0 hr. 1 min. 7 sec
Trace Level off
Security ON: Password or Local OS Authentication
SNMP OFF
Listener Log File C:\oracle\product\10.2.0\db_3\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC210881539119)(PORT=1521)))
Services Summary...
Service "+ASM_XPT" has 1 instance(s).
Instance "+asm", status BLOCKED, has 1 handler(s) for this service...
Service "+asm" has 1 instance(s).
Instance "+asm", status BLOCKED, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 04-JAN-2011 04:59:28
Uptime 0 days 0 hr. 0 min. 18 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File C:\oracle\product\10.2.0\db_3\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC210881539119)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> change_password
Old password:
New password:
Reenter new password:
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Password changed for LISTENER
The command completed successfully
--
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 04-JAN-2011 04:59:28
Uptime 0 days 0 hr. 1 min. 7 sec
Trace Level off
Security ON: Password or Local OS Authentication
SNMP OFF
Listener Log File C:\oracle\product\10.2.0\db_3\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC210881539119)(PORT=1521)))
Services Summary...
Service "+ASM_XPT" has 1 instance(s).
Instance "+asm", status BLOCKED, has 1 handler(s) for this service...
Service "+asm" has 1 instance(s).
Instance "+asm", status BLOCKED, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
воскресенье, 2 января 2011 г.
FGA: restrict on row level
--
BEGIN
dbms_rls.drop_policy(object_schema => 'test',
object_name => 'rls',
policy_name => 'test_policy');
dbms_rls.add_policy(object_schema => 'test',
object_name => 'rls',
policy_name => 'test_policy',
function_schema =>'test',
policy_function => 'subfun.policy_function',
policy_type => dbms_rls.SHARED_STATIC);
END;
--
09:18:43 22 169 TEST@orcl> create package test.subfun as FUNCTION policy_function (object_schema IN VARCHAR2, object_name VARCHAR2)
09:18:55 2 RETURN VARCHAR2;
09:19:02 3 end
09:19:04 4 ;
09:19:05 5 /
--
09:20:38 22 169 TEST@orcl> create or replace package body test.subfun as FUNCTION policy_function (object_schema IN VARCHAR2, object_name VARCHAR2)
09:20:53 2 RETURN VARCHAR2 is begin return 'id = 1'; end;
09:20:59 3 end;
09:20:59 4 /
Package body created.
09:34:11 22 170 TEST@orcl> select * from rls;
ID
------------------------------------
1.0
1 row selected.
09:37:18 22 4294967295 SYS@orcl> select * from test.rls;
ID
------------------------------------
1.0
3.0
2 rows selected.
BEGIN
dbms_rls.drop_policy(object_schema => 'test',
object_name => 'rls',
policy_name => 'test_policy');
dbms_rls.add_policy(object_schema => 'test',
object_name => 'rls',
policy_name => 'test_policy',
function_schema =>'test',
policy_function => 'subfun.policy_function',
policy_type => dbms_rls.SHARED_STATIC);
END;
--
09:18:43 22 169 TEST@orcl> create package test.subfun as FUNCTION policy_function (object_schema IN VARCHAR2, object_name VARCHAR2)
09:18:55 2 RETURN VARCHAR2;
09:19:02 3 end
09:19:04 4 ;
09:19:05 5 /
--
09:20:38 22 169 TEST@orcl> create or replace package body test.subfun as FUNCTION policy_function (object_schema IN VARCHAR2, object_name VARCHAR2)
09:20:53 2 RETURN VARCHAR2 is begin return 'id = 1'; end;
09:20:59 3 end;
09:20:59 4 /
Package body created.
09:34:11 22 170 TEST@orcl> select * from rls;
ID
------------------------------------
1.0
1 row selected.
09:37:18 22 4294967295 SYS@orcl> select * from test.rls;
ID
------------------------------------
1.0
3.0
2 rows selected.
четверг, 30 декабря 2010 г.
Dev: get client variable in pl/sql
SQL> var val varchar2(4000)
SQL> set autoprint on
SQL> exec sys.dbms_system.get_env('nls_lang',:val);
PL/SQL procedure successfully completed.
VAL
--------------------------------------------------------------------------------
AMERICAN_AMERICA.CL8MSWIN1251
SQL> set autoprint on
SQL> exec sys.dbms_system.get_env('nls_lang',:val);
PL/SQL procedure successfully completed.
VAL
--------------------------------------------------------------------------------
AMERICAN_AMERICA.CL8MSWIN1251
среда, 29 декабря 2010 г.
shared pool free memory
--
-- Free memory in shared pool and in reserved_pool separately, percent of free space current and min for reserved pool
--
select s.pool, round((s.bytes - p.free_space)/1024/1024, 3) fm, round((p.free_space)/1024/1024, 3) fm_reserved
, round(((s.bytes - p.free_space)/decode(sps.value, 0, NULL, sps.value))*100, 3) pct_free
, round(((sps_reserved.value - p.max_used_size)/sps_reserved.value)*100, 3) pct_free_reserved_min
from v$sgastat s, v$shared_pool_reserved p, v$parameter sps, v$parameter sps_reserved
where s.pool = 'shared pool' and s.name = 'free memory'
and sps.name='shared_pool_size'
and sps_reserved.name='shared_pool_reserved_size'
;
-- Free memory in shared pool and in reserved_pool separately, percent of free space current and min for reserved pool
--
select s.pool, round((s.bytes - p.free_space)/1024/1024, 3) fm, round((p.free_space)/1024/1024, 3) fm_reserved
, round(((s.bytes - p.free_space)/decode(sps.value, 0, NULL, sps.value))*100, 3) pct_free
, round(((sps_reserved.value - p.max_used_size)/sps_reserved.value)*100, 3) pct_free_reserved_min
from v$sgastat s, v$shared_pool_reserved p, v$parameter sps, v$parameter sps_reserved
where s.pool = 'shared pool' and s.name = 'free memory'
and sps.name='shared_pool_size'
and sps_reserved.name='shared_pool_reserved_size'
;
peformance issue - nls_lang
set NLS_LANG=american_america.utf8
--
19:54:07 SQL> select * from character_set;
171080 rows selected.
Elapsed: 00:00:29.68
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
3808 consistent gets
2009 physical reads
0 redo size
16942067 bytes sent via SQL*Net to client
1026 bytes received via SQL*Net from client
59 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
171080 rows processed
--
set NLS_LANG=
--
SQL> select * from character_set;
171080 rows selected.
Elapsed: 00:00:02.26
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
14909 consistent gets
2855 physical reads
0 redo size
18383263 bytes sent via SQL*Net to client
125854 bytes received via SQL*Net from client
11407 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
171080 rows processed
--
19:54:07 SQL> select * from character_set;
171080 rows selected.
Elapsed: 00:00:29.68
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
3808 consistent gets
2009 physical reads
0 redo size
16942067 bytes sent via SQL*Net to client
1026 bytes received via SQL*Net from client
59 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
171080 rows processed
--
set NLS_LANG=
--
SQL> select * from character_set;
171080 rows selected.
Elapsed: 00:00:02.26
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
14909 consistent gets
2855 physical reads
0 redo size
18383263 bytes sent via SQL*Net to client
125854 bytes received via SQL*Net from client
11407 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
171080 rows processed
Подписаться на:
Сообщения (Atom)
Update BLOB
set define off DECLARE vb1 CLOB := 'long text'; vb2 CLOB := 'long text'; vb3 CLOB := ...