пятница, 7 января 2011 г.

Recover: check object for curruption

07:31:25 19 4294967295 SYS@orcl> exec dbms_repair.admin_tables(table_type => dbms_repair.repair_table, action => dbms_repair.create_action);

PL/SQL procedure successfully completed.

07:32:33 19 4294967295 SYS@orcl> exec dbms_repair.check_object('SYS', 'FT', CORRUPT_COUNT => :v);

PL/SQL procedure successfully completed.


V
------------------------------------
.0

вторник, 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.

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

воскресенье, 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.

Update BLOB

set define off DECLARE    vb1 CLOB := 'long text';    vb2 CLOB :=                 'long text';    vb3 CLOB :=              ...