Audit columns – Created by and Updated By

I have seen two database designs to store the value in Created by and Updated By columns as: Store the PK of user in Created by and Updated By columns Store the user name in Created by and Updated By columns Now you may have question: What is best practice to store the value in the Created by and Updated By columns and why? My opinion is PK of user (user id) is preferred over user name. There are various

» Read more

How To – Find the locking object and release object lock

Many time we faced the performance issue because of Locks on rows and it cause the delay to finishing the other transactions. So with the help of following steps you will able to find the locking objects and can release the object locks in Oracle Database. Let us create the example to understand clearly Terminal – 1 Step -1:  Here we have execute the Update Statement in the SCOTT Schema without Commit Terminal – 2 Step -2: Now we try

» Read more

Oracle Data Pump (expdp and impdp)

Data Pump Export is a utility for unloading data and metadata into dump file. The same exported dump file can be imported only by Data Pump Import utility. With the help of this Data Pump Export we can export the data of one machine and import into another machine. Dump File : The dump file set is made up of one or more disk files that contain table data, database object metadata, and control information. The files are written in

» Read more

Toad – SQLNET Editor and TNS Names Editor Disabled

While trying to connect to a Database using Toad with TNS, Even the TNS entry is created in tnsnames.ora file under Oracle Home\NETWORK\ADMIN Issue 1: SQLNET Editor and TNS Names Editor Disabled as shown in below snapshot  Issue 2: Not able to find the TNS Name in the dropdown as shown in below snapshot Cause: TNS entry missing in the environmental variables Resolution:  Go to environmental variables and create a new variable Name as “TNS_ADMIN” and set the value as  Oracle Home\NETWORK\ADMIN

» Read more

8 Steps of Successful Data Migration

Data migration is the process of transferring data between storage types, formats, or computer systems. But here we are specifically talking about database (i.e. Sybase, MySQL, DB2, SQL Server and Oracle) migration. Data migration is usually performed programmatically to achieve an automated migration. Most of the times when we change the software system and implement a new database or change the database vendor then we will need to migrate the data from an existing database to a new database in

» Read more

Oracle – Create tablespace and User / Schema

Creating a tablespace and user is a very common task after creating an oracle database. Before going further must read the post Schema vs. User In this post we will see how to create tablespace and user with example Tablespace Each tablespace in an Oracle database consists of one or more files called data files. A permanent tablespace contains persistent schema objects. Objects in permanent tablespaces are stored in data files. Script 1: Create Tablespace CREATE TABLESPACE "test01" LOGGING DATAFILE

» Read more

Oracle Client Installation

Installation Steps: Extract the OracleClientODBC-32Bit or OracleClientODBC-64Bit zipped folder according to the Machine (32bits or 64bits). Now set 4 environment variables at client machine as System Variable. My Computer Properties >> Advanced >> Environment Variables PATH: Set the path. Put ‘;’ at the end of existing path and give the path of folder where the files are extracted. LD_LIBRARY_PATH: New environment variable is created with the path of same folder. ORACLE_HOME:New environment variable if not present with same path. TNS_ADMIN:

» Read more

Oracle – Import data from CSV file using SQL Loader

In this post we will see how we can transfer the data from CSV to oracle database using SQL Loader. SQL Loader is a bulk loader utility used for moving data from external files into the Oracle database. One can use SQL Loader utility to transfer the data for high performance. Syntax: sqlldr username@server/password control=control_file.ctl sqlldr username/password@server control= control_file.ctl Exmaple: Let‘s take a CSV file named as test_data.csv First we need to create a table where we want to transfer

» Read more

Oracle – Table Row count for all tables

Here is a simple SQL script with the help we can find the Table Row count for all tables. Yes we can find the row count using select count(*) for each table. This will be useful if you large number of tables are there in your database. Example Script: — Create a table CREATE TABLE ROW_COUNT_ALL_TABLE ( TABLE_NAME VARCHAR2(100), ROW_COUNT VARCHAR2(100) ) — PL-SQL Block to count Row Count for all tables as you specify DECLARE V_ROW_COUNT VARCHAR2(100); V_SQL_STRING VARCHAR2(1000);

» Read more

Oracle – ORA-01653 – unable to extend table in tablespace – Fix

Error: ORA-01653: unable to extend table in tablespace Cause: Failed to allocate an extent of the required number of blocks for a table segment in the tablespace indicated. Note: Change the table space name for that you need the information in the below Scripts (Script: 1 & 2) Solution: Script: 1 Execute the below query to find the Used Size, Free Size, Total Size of a table space select df.tablespace_name "Tablespace", totalusedspace "Used MB", (df.totalspace – tu.totalusedspace) "Free MB", df.totalspace

» Read more

Oracle – Auto Generate Insert Statement with Toad

This is very quick way to generate the Insert Statement for all of the data in your table. Let us take an example; we have a table as shown below… Right click on the Result Grid and go to Option à Export Dataset Select the Export Format as “Insert Statement” Select the Output file location and name You can also change the Schema (if required) Required Out file is ready with Insert statement as If you have any comment/suggestion please

» Read more
1 2 3 4