SELECT B.Owner, B.Object_Name, A.Oracle_Username, A.OS_User_Name
FROM V$Locked_Object A, All_Objects B
WHERE A.Object_ID = B.Object_ID
jueves, 25 de junio de 2020
SCRIPT BLOQUEOS INSTANCIA DE BASE DE DATOS
TRIGGER EVENTOS
List of Database Events
System Events
Table 10-2 System Manager Events
Client Events
CREATE OR REPLACE TRIGGER On_Logon AFTER LOGON ON The_user.Schema BEGIN Do_Something; END;
LOGON
and LOGOFF
events allow simple conditions on UID( )
and USER( )
. All other events allow simple conditions on the type and name of the object, as well as functions like UID( )
and USER( )
.LOGON
event starts a separate transaction and commits it after firing the triggers. All other events fire the triggers in the existing user transaction.LOGON
and LOGOFF
events can operate on any objects. For all other events, the corresponding trigger cannot perform any DDL operations, such as DROP
and ALTER
, on the object that caused the event to be generated.CREATE TRIGGER
), it cannot be fired later during the same transactionTable 10-3 Client Events
martes, 23 de junio de 2020
REBUILD INDICES
sábado, 20 de junio de 2020
ORACLE CONSUMO CPU X USUARIO
PRIVILEGIOS WITH ADMIN OPTION - WITH GRANT OPTION
Privileges that are granted WITH ADMIN OPTION can be passed to other users. Hence, many companies prohibit this option, and others check to ensure that all user ID's are proper. Here is an example of the usage of the with admin option keyword.
GRANT
CREATE INDEX
TO
Robert
WITH ADMIN OPTION;
The metadata security audit information for users having the WITH ADMIN OPTION is located in the DBA_SYS_PRIVS view. Read more here.
The "with grant" privilege
The WITH GRANT option allows you to give the user you are assigning the privilege to grant this privilege to other users. Only the schema that owns the object can grant privileges to that object unless the WITH GRANT option is included in the command. Here is an example of the use of the with grant option:
GRANT SELECT ON
emp
TO
scott
WITH GRANT OPTION;
CREATE USER ROLE DBA
select * from v$pwfile_users;
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM CON_ID
------------------------------ ----- ----- ----- ----- ----- ----- ----------
SYS TRUE TRUE FALSE FALSE FALSE FALSE 0
SYSDG FALSE FALSE FALSE FALSE TRUE FALSE 0
SYSBACKUP FALSE FALSE FALSE TRUE FALSE FALSE 0
SYSKM FALSE FALSE FALSE FALSE FALSE TRUE 0
ORACLE RAC COMANDOS BAJAR SUBIR INSTANCIA BD
CREACIÓN ACL ORACLE ACCESS LIST
CREACIÓN ACL
begin
dbms_network_acl_admin.create_acl (
acl => 'utl_http.xml',
description => 'HTTP Access',
principal => 'ORCL',
is_grant => TRUE,
privilege => 'connect',
start_date => null,
end_date => null
);
commit;
End;
/
begin
dbms_network_acl_admin.assign_acl (
acl
=> 'utl_http.xml',
host
=> '10.1.X.X',
lower_port => 1,
upper_port => 10000
);
commit;
end;
/
jueves, 18 de junio de 2020
martes, 16 de junio de 2020
ORACLE RESPONSE FILE
setup -record -destinationFile C:\response_files\install_oracle11g.rsp (on Windows) ./runInstaller -record -destinationFile /private/temp/install_oracle11g.rsp (on UNIX)
setup.exe -responseFile <filename> <optional_parameters> (on Windows) ./runInstaller -responseFile <filename> <optional_parameters> (on UNIX)
sábado, 13 de junio de 2020
SESIONES ORACLE FILTRANDO USUARIOS
select
substr(a.spid,1,9) pid,
substr(b.sid,1,5) sid,
substr(b.serial#,1,5) ser#,
substr(b.machine,1,6) box,
substr(b.username,1,10) username,
b.server,
substr(b.osuser,1,8) os_user,
substr(b.program,1,30) program
from v$session b, v$process a
where
b.paddr = a.addr
and type='USER'
order by spid
viernes, 12 de junio de 2020
Solaris LDOMs
Allocating VCPU
1. Setting the VCPUs to 6 :
# ldm set-vcpu 6 ldom01
2. To add additional 2 VCPUs :
# ldm add-vcpu 2 ldom01
3. To remove 2 VCPUs :
# ldm remove-vcpu 2 ldom01
Allocating Memory
1. Setting the Memory to 6 GB :
# ldm set-memory 6G ldom01
2. To add additional 2 GB memory :
# ldm add-memory 2G ldom01
3. To remove 2 GB memory :
# ldm remove-memory 2G ldom0
jueves, 11 de junio de 2020
SET SERVEROUTPUT ON MOSTRAN MENSAJES PROCEDURES & FUNCIONES
spool generar archivo plano
alter session set current_schema=HR;
set echo offset verify offset heading offset feedback offset pagesize 0spool /home/oracle/create_table.sqlselect 'CREATE TABLE ' || TABLE_NAME || '_TEST ' || 'AS SELECT * FROM ' || TABLE_NAME || ' WHERE 1=2;' from user_tables/spool off
set echo offset verify offset feedback offset pagesize 0spool /home/oracle/drop_table.sqlselect 'DROP TABLE ' || TABLE_NAME || ';'from user_tableswhere table_name like '%_TEST'/spool offset heading onset feedback onexit
martes, 9 de junio de 2020
VER INDICES DE UNA TABLA
sábado, 6 de junio de 2020
CHECK CONSTRAINT ALTER TABLE ADD CONSTRAINT
Using an ALTER TABLE statement
The syntax for creating a check constraint in an ALTER TABLE statement in Oracle is:
ALTER TABLE table_name ADD CONSTRAINT constraint_name CHECK (column_name condition) [DISABLE];
The DISABLE keyword is optional. If you create a check constraint using the DISABLE keyword, the constraint will be created, but the condition will not be enforced.
Example
ALTER TABLE suppliers ADD CONSTRAINT check_supplier_name CHECK (supplier_name IN ('IBM', 'Microsoft', 'NVIDIA'));
martes, 2 de junio de 2020
CREATE PUBLIC SYNONYM
SCRIPT AWK PARA MONITOREAR PROCESOS
linux grep BUSQUEDAS DENTRO DE LOS ARCHIVOS
UTLRP.SQL RECOMPILAR OBJECT INVALIDOS
lunes, 1 de junio de 2020
UNDO RETENTION GUARANTEE ESTADISTICAS CONFIGURACION
SQL>show parameter undo_retention;
select to_char(begin_time, 'DD-MON-RR HH24:MI') begin_time, to_char(end_time, 'DD-MON-RR HH24:MI') end_time, tuned_undoretention from v$undostat order by end_time; BEGIN_TIME END_TIME TUNED_UNDORETENTION --------------- --------------- ------------------- 04-FEB-05 00:01 04-FEB-05 00:11 12100 ... 07-FEB-05 23:21 07-FEB-05 23:31 86700 07-FEB-05 23:31 07-FEB-05 23:41 86700 07-FEB-05 23:41 07-FEB-05 23:51 86700 07-FEB-05 23:51 07-FEB-05 23:52 86700 576 rows selected.
SQL>alter tablespace undotbs1 retention guarantee
SQL>alter tablespace undotbs1 retention noguarantee
-- Guarantee the minimum threshold is maintained. ALTER TABLESPACE undotbs1 RETENTION GUARANTEE; SELECT tablespace_name, retention FROM dba_tablespaces; TABLESPACE_NAME RETENTION ------------------------------ ----------- SYSTEM NOT APPLY UNDOTBS1 GUARANTEE SYSAUX NOT APPLY TEMP NOT APPLY USERS NOT APPLY 5 rows selected. -- Switch back to the default mode. ALTER TABLESPACE undotbs1 RETENTION NOGUARANTEE;SQL> select tablespace_name,retention from dba_tablespaces; TABLESPACE_NAME RETENTION ------------------------------ ----------- SYSTEM NOT APPLY SYSAUX NOT APPLY UNDOTBS1 NOGUARANTEE TEMP NOT APPLY USERS NOT APPLY EXAMPLE NOT APPLY DATOS NOT APPLY 7 rows selected. SQL> alter tablespace undotbs1 retention guarantee; Tablespace altered. SQL> select tablespace_name,retention from dba_tablespaces; TABLESPACE_NAME RETENTION ------------------------------ ----------- SYSTEM NOT APPLY SYSAUX NOT APPLY UNDOTBS1 GUARANTEE TEMP NOT APPLY USERS NOT APPLY EXAMPLE NOT APPLY DATOS NOT APPLY 7 rows selected.
SQL> ALTER SYSTEM SET TEMP_UNDO_ENABLED=TRUE;V$TEMPUNDOSTAT;SELECT TO_CHAR(BEGIN_TIME, 'MM/DD/YYYY HH24:MI:SS') BEGIN_TIME, TO_CHAR(END_TIME, 'MM/DD/YYYY HH24:MI:SS') END_TIME, UNDOTSN, UNDOBLKCNT, MAXCONCURRENCY FROM V$TEMPUNDOSTAT;