Add string to query Oracle 11g
Suppose you have a query result and want to concatenate a string to that output for better readibility, it can be done using the Concat operator in SQL*PLUS Select Name, Size from Table ; EMV_DATA...
View ArticleLargest Tables in Oracle
Query to find out size of the 10 Largest Tables sitting inside an Oracle database select segment_name as “Table Name” , round (bytes/1024/1024/1024) || ‘ GB’ as “Size” from user_segments where bytes...
View ArticleSelect Random Rows from Table in Oracle
To select 10 random records from a table in Oracle SELECT * FROM ( SELECT * FROM TABLE_NAME ORDER BY dbms_random.value ) WHERE rownum <= 10 ;
View ArticleCREATE TABLE REPLICATION USING MATERIALIZED VIEWS ORACLE
CREATE TABLE REPLICATION USING MATERIALIZED VIEWS ————————————————- SOURCE TABLE : LOG_RECORD TARGET TABLE : LOG_RECORD_UPD We have a large table called Log_Record with well over 50 million rows and we...
View Articleld.so.1: ggsci: fatal: libclntsh.so.11.1:
This error comes when running ggsci on a linux or unix platform. Generally it is due to wrong setting of parameter LD_LIBRARY_PATH $ echo $LD_LIBRARY_PATH Edit the profile of the user and set...
View ArticleGenerating HTML Reports from SQL*Plus
This is a script to query a table, generate the result in HTML and send an email using mailx for the report. #!/bin/ksh . $HOME/.bash_profile NOW=$(date +”%a %b %e %T %Y”) MON=$(date +”%b %Y”)...
View ArticleGenerate Excel | CSV Report from SQL*PLUS
Shell Script to generate a column seperator report in SQL*PLUS using a shell script. It can be opened in Excel and or text editor like NOTEPAD++ #!/bin/ksh . $HOME/.bash_profile NOW=$(date +”%a %b %e...
View ArticleOracle External Table
Oracle allows the database to access a flat file as a table. You can have a flat file with a delimiter, it can be accessed from Oracle. This is one of the best methods to load Data into Oracle...
View ArticleGenerate Insert Statements Dynamically
– Insert statements dynamically – Select ‘insert into abc values(‘||col1||’,'||col2||’,'||col3||’,'||col4||’);’ from xyz;
View ArticlePLS-00201: identifier ‘SYS.DBMS_SUPPORT’ must be declared
This error generally occurs when you are trying to trace a user session using the DBMS_SUPPORT package. But this package isn’t installed by default in Oracle. So you have to install it. You can install...
View ArticleBlock access to database oracle
This is a script to create a logon trigger for blocking third party tools like Toad, SQl Navigator etc from accesing a production database. The script is taken from:...
View ArticleOracle is written in which programming language ?
After years of working with Oracle database. There is an intriguing question which came in my mind today after doing some research on X$ Views. In my search of X$ views; I found that X$ views are...
View ArticleBut I want to store the date in format .....
Reblogged from Ed Stevens, DBA: Taking a breather from my exploration of TNS connection issues, I’d like to take a quick romp through the use (and MIS-use) of date formatting. There are no deep...
View ArticleMake Table Read Only Oracle
– Make Table Read Only alter table <table_name> read only; – Make Table Back to Read Write. alter table <table_name> read write;
View ArticleChange NLS_DATE_FORMAT via logon triggers
NLS_DATE_FORMAT is a parameter heavily dependent on a session. A good practice is to write a logon trigger depending on the application requirement to set this parameter write at the session logon. It...
View ArticleTrigger on Change of Column Value in Oracle
Suppose you need to fire a trigger based on the change of value of a column and then perform some action based on it. You can do it easily like the below. CREATE OR REPLACE TRIGGER TEST_TRIGGER after...
View ArticleWhy you can’t commit inside a trigger ?
Well to put it across in a few words. A trigger is a part of a transaction and not a transaction in itself. So Oracle doesn’t let you commit in a trigger. You can commit in a trigger by using PRAGMA...
View ArticleDrop Database Manually Oracle
————- Drop Database Manually Oracle ——————— 1. First get the datafiles, control files and redo log files location Login to sqlplus as sysdba and execute below script : DECLARE TYPE string_arr IS TABLE...
View ArticleDBA Joke
“An irrefutable tenet of physics argues that matter cannot exist in two places at one time. But data definitely can and often should.” So DBA’s are not just fighting disasters and outages, but...
View ArticleIBM Websphere MQ
I know we are an Oracle DB blog. But for Technology enthusiasts an opportunity to learn something new shouldn’t pass by.
View Article