Posts

Showing posts from April, 2016

USING SELECT 'X' in query/subqueries.

  USING SELECT 'X' in query/sub-queries. -------------------------------------------------------- --  DDL for Table TAB1 --------------------------------------------------------   CREATE TABLE "ATEST"."TAB1"    (    "ID" NUMBER,     "NAME" VARCHAR2(20 BYTE)    ) ; Insert into ATEST.TAB1 (ID,NAME) values (1,'AAA'); Insert into ATEST.TAB1 (ID,NAME) values (2,'BBB'); Insert into ATEST.TAB1 (ID,NAME) values (3,'EEE'); Insert into ATEST.TAB1 (ID,NAME) values (4,'FFF'); -------------------------------------------------------- --  DDL for Table TAB2 --------------------------------------------------------   CREATE TABLE "ATEST"."TAB2"    (    "ID" NUMBER,     "NAME" VARCHAR2(20 BYTE)    ) ; Insert into ATEST.TAB2 (ID,NAME) values (1,'CCC'); Insert into ATEST.TAB2 (ID,NAME) values (2,'DDD'); Get records that exits in TAB1 and not in TAB2 using select 'X...

sql for first day of month and last day of month

select SYSDATE , last_day(sysdate) as LAST_DATE_CURR_MNTH, ADD_MONTHS(last_day(sysdate),-1) as PREVIOUS_MON_LAST_DATE, last_day(sysdate)+1 as NEXT_MON_FIRST_DATE, ADD_MONTHS(last_day(sysdate),+1) as NEXT_MON_LAST_DATE, ADD_MONTHS(last_day(sysdate),+5) as LAST_DATE_OF_5TH_MON, ADD_MONTHS(last_day(sysdate),+5) +1 as FIRST_DATE_IN_6TH_MON_AFTR_NOW   from dual; "SYSDATE"    "LAST_DATE_CURR_MNTH"    "PREVIOUS_MON_LAST_DATE"    "NEXT_MON_FIRST_DATE"    "NEXT_MON_LAST_DATE"    "LAST_DATE_OF_5TH_MON"    -----------  ---------------------   ------------------------    ---------------------   --------------------    ----------------------- "FIRST_DATE_IN_6TH_MON_AFTR_NOW" ----------------------- 01-APR-16        30-APR-16                31-MAR-16 ...

CHANGE STANDBY DATABASE PROTECTION MODE

SQL> select protection_mode from v$database; PROTECTION_MODE -------------------- MAXIMUM PERFORMANCE SQL> show parameter log_archive_dest_2 NAME                     TYPE     VALUE ------------------------------------ ----------- ------------------------------ log_archive_dest_2             string     SERVICE=ORCLSTB1 NOAFFIRM ASYN                          C VALID_FOR=(ONLINE_LOGFILES,P                          RIMARY_ROLE) DB_UNIQUE_NAME=OR                          CLSTB1 log_archive_dest_20        ...