Posts

Oracle Lock table

 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 select * from V$Locked_Object select    c.owner,    c.object_name,    c.object_type,    b.sid,    b.serial#,    b.status,    b.osuser,    b.machine from    v$locked_object a ,    v$session b,    dba_objects c where    b.sid = a.session_id and    a.object_id = c.object_id;

create tablespace with multiple datafiles

CREATE TABLESPACE TBS_DATA     DATAFILE          '/oradata/PCDB/PINSV/tbs_data_001.dbf' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE 25G,          '/oradata/PCDB/PINSV/tbs_data_002.dbf' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE 25G,             '/oradata/PCDB/PINSV/tbs_data_003.dbf' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE 25G; CREATE TABLESPACE TBS_INDEX      DATAFILE          '/oradata/PCDB/PINSV/tbs_index_001.dbf' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE 25G,          '/oradata/PCDB/PINSV/tbs_index_002.dbf' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE 25G,             '/oradata/PCDB/PINSV/tbs_index_003.dbf' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE 25G; --windows---- CREATE TABLESPACE TBS_DATA     DATAFILE          'D:\ORACLE\ORA11G\APP\ADMINISTRATOR\ORADATA\PRAN\tbs_data_001.dbf' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE 25G,          'D:\ORACLE\ORA11G\APP\ADMINISTRATOR\ORADATA\PRAN\tbs_data_002.dbf' SIZE 1G AUTOEXTEND ON NEXT 100M MAXS

impdp & expdp

  directory creation command  CREATE OR REPLACE DIRECTORY bk_directory AS '/data/back'; Export data pump command expdp user/passs@tns schemas=QTAN dumpfile=qtann.dmp logfile=qtannll.log Import data pump command impdp user/pass@tns schemas=QTAN REMAP_SCHEMA=QTAN:VHCL dumpfile=qtann.dmp logfile=qtannimp.log CREATE USER SABUJ IDENTIFIED BY 1121; GRANT UNLIMITED TABLESPACE TO SABUJ ; GRANT CONNECT TO SABUJ; GRANT DBA TO SABUJ; COMMIT; host imp FC/fcc@DITF_RFL fromuser=FC touser=FC file=FC.DMP log=FC.log

Move all table or index to a new / different tablespace while it is online

 select 'alter index '||owner||'.'||index_name||' rebuild tablespace TBS_INDEX ONLINE;' from all_indexes where owner='SABUJ'; select 'ALTER TABLE '||owner||'.'||TABLE_NAME||' MOVE ONLINE tablespace TBS_DATA ;' from all_tables where owner='SABUJ'; SELECT 'ANALYZE TABLE '||owner||'.' || table_name || ' COMPUTE STATISTICS;' FROM   all_tables WHERE  owner in  ('SABUJ','HRMS') ORDER BY 1; select 'analyze index '||owner||'.'||index_name||' validate structure;' from dba_indexes where owner in  ('SABUJ','HRMS')

ERROR: Unable to verify the graphical display setup. This application requires X display. Make sure that xdpyinfo exist under PATH variable. Invalid MIT-MAGIC-COOKIE-1 key

  ERROR: Unable to verify the graphical display setup. This application requires X display. Make sure that xdpyinfo exist under PATH variable. Invalid MIT-MAGIC-COOKIE-1 key Can't connect to X11 window server using ':1.0' as the value of the DISPLAY variable. root user> xhost+; ora user> EXPORT DISPLAY=:1.0; ora user> xhost+; [root@ritf20 ~]# xhost+ bash: xhost+: command not found... Similar command is: 'xhost' [root@ritf20 ~]# xhost + access control disabled, clients can connect from any host [root@ritf20 ~]# su - orapran Last login: Sat Jun 11 18:13:17 +06 2022 on pts/1 [orap@ritf20 ~]$ export DISPLAY=:1.0; [orap@ritf20 ~]$ xhost + access control disabled, clients can connect from any host

Highlighted Column in Report based Condition in Oracle APEX

page level Inline CSS    .chip{ padding:4px 10px; border-radius:16px; box-shadow:0 1px 2px 0 rgba(0,0,0,.05); } .chip-success{ background: #cdffe0; color: #00592e; } .chip-danger{ background: #ffebeb; color: #a50000; } .chip-warning{ background: #fffedc; color: #764400; } .chip-primary{ background: #cdffe0; color: #004f95; } CASE R.IS_CONFIRM when 'Y'  then '<span class="chip chip-success">Approved </span>' else '<span class="chip chip-danger">Cancled </span>' end  IS_CONFIRM

Changing the Archive Log Destination

  SQL> ALTER SYSTEM SET log_archive_dest_1 = '/data/backup/archive' scope=spfile; System altered. SQL> show parameter log_archive_dest