1. Try to login to database with SYS AS SYSDBA user. If the instance is idle, run the startup command.
Monday, October 16, 2023
Problem with database open ORA-19804, ORA-19809, ORA-03113
Saturday, August 26, 2023
Oracle - create public database link to oracle db
1. Change sqlnet.ora file from SQLNET.AUTHENTICATION_SERVICES= (NTS) to SQLNET.AUTHENTICATION_SERVICES= (NONE)
2. Create public database link with command:
CREATE PUBLIC DATABASE LINK DBLINK1
CONNECT TO REMOTE_USER_NAME IDENTIFIED BY password
USING '(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.2 )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)';
COMMIT;
3. Test link with command:
select * from table_name@DBLINK1;
4. Drop link with command:
DROP DATABASE LINK DBLINK1;
COMMIT;
Oracle - calculate time difference with time_zone adjustment
Task: Calculate difference between CREATEDON column (with UTC time_zone) and CURRENT_DATE (with local time zone from database)
Table contents:
select CREATEDON, CURRENT_DATE from TABLE_NAME;
Query:
with time_difference as
(
select
cast(FROM_TZ(CAST(CREATEDON AS TIMESTAMP), 'UTC') at time zone (SELECT DBTIMEZONE FROM DUAL) as date) AS Created,
cast(FROM_TZ(CAST(CURRENT_DATE AS TIMESTAMP), (SELECT DBTIMEZONE FROM DUAL)) AS DATE) AS CurrentDate
from TABLE_NAME
)
select
to_char(Created,'YYYY-mm-dd HH24:MI') as Created,
to_char(CurrentDate ,'YYYY-mm-dd HH24:MI') as CurrentDate,
round((CurrentDate - Created) * 24 * 60) as DifferenceInMinutes
from time_difference;
Result:
Wednesday, September 18, 2019
SSIS - odbc oracle delete query
SSIS - problem with odbc oracle delete query
SQL delete query which is not affecting any records will return the result SQL_NO_DATA. SSIS odbc is not able to handle this kind of result.
1. Create query with dual select at the end
delete from table;
select 1 from dual;
2. Create procedure to delete data
create or replace PROCEDURE delete_table is
begin
delete from table;
end;
SSIS - Call oracle procedure from Microsoft SQL Server integration services
SSIS - Call oracle procedure from Microsoft SQL Server integration services
Tuesday, April 16, 2019
APEX 5 - interactive report scale resize image
APEX 5 - interactive report re-size image
Monday, November 26, 2018
ORACLE RMAN: Delete archivelogs older than X hours batch
ORACLE RMAN: Delete archive logs older than X hours
Oracle, RMAN
Tuesday, February 6, 2018
ORACLE: Microsoft Access x64 connect to x86 oracle data source (workaround)
ORACLE: Microsoft Access x64 connect to x86 oracle data source (workaround)
Microsoft Access, Oracle
Tuesday, January 30, 2018
ORACLE: scheduled task (oracle scheduler)
ORACLE - Scheduled task (Oracle scheduler)
Oracle, PL/SQL
1. Create a program
begin dbms_scheduler.create_program( program_name => 'READ_FILES_PROG' ,program_type => 'STORED_PROCEDURE' ,program_action => 'READ_FILES_PROC' ,number_of_arguments => 0 ,enabled => true ,comments => 'Read files from directory' ); end;
2. Create a schedule
BEGIN DBMS_SCHEDULER.CREATE_SCHEDULE ( schedule_name => 'READ_FILES_SCH', start_date => TO_TIMESTAMP('2014-06-28 06:15:00','YYYY-MM-DD HH24:Mi:SS'), end_date => TO_DATE('9999-12-31','YYYY-MM-DD'), repeat_interval => 'FREQ=MINUTELY; INTERVAL=15', comments => 'Every 15 minutes'); END;
3. Create a job
begin dbms_scheduler.create_job( job_name => 'READ_FILES_JOB' , program_name =>'READ_FILES_PROG' , schedule_name =>'READ_FILES_SCH' , enabled => TRUE , comments => 'Read files every 15 minutes'); end;
4. Enable log
begin DBMS_SCHEDULER.SET_ATTRIBUTE('READ_FILES_JOB','logging_level',DBMS_SCHEDULER.LOGGING_FULL); end;
5. Restart job and read log
Disable job
begin DBMS_SCHEDULER.DISABLE('READ_FILES_JOB',TRUE); end;
Enable job
begin DBMS_SCHEDULER.ENABLE('READ_FILES_JOB'); end;
Display log
select * from dba_scheduler_jobs where owner like 'SCHEMA NAME';
Tuesday, January 23, 2018
SAP/ABAP: Connection to external database
SAP/ABAP: Connection to external database
SAP, ORACLE, ABAP
Example INSERT INTO database
Code section: Record processing:
Example SELECT FROM database
Code section: Record processing:
SQL: group by number of rows (divide result into sections with particular number of rows)
SQL: group by number of rows
Oracle
Example shows how to divide "group by clause"result into sections with particular number of rows.Table:
select column1 from table1;
with query1 as
(
select
column1,
row_number() OVER (PARTITION BY column1 ORDER BY column1)-1 as c1
from table1
)
select
column1,
count(column1)
from query1
group by column1, floor(c1/4)
order by column1, count(column1) desc
Result:
Problem with database open ORA-19804, ORA-19809, ORA-03113
1. Try to login to database with SYS AS SYSDBA user. If the instance is idle, run the startup command. 2. If ORA-03113 occured, check the la...
-
SAP/ABAP: Connection to external database SAP, ORACLE, ABAP 1. Transaction code: ST04 - Add connection 2. Press “Add DB Entry”...
-
1. Get a key How to: https://baselinker.com/pl-PL/pomoc/wiedza/api/ I will XXXXXXX as a example of key = api token 2. Create a macro with PO...
-
To assign access rights manually (to both users and groups) use secpol.msc → Local Policies → User Rights Assignment → Log on as batch job....


