To Create an External Table from CSV File, Follow these simple Steps
1) Create a Directory
2) Grant Read/Write Permission to that Directory
3) Place your CSV file in that directory at OS Level
4) Create EXTERNAL Table
Example:
1) create or replace directory MYCSV as '/home/oracle/mycsv';
Note: /home/oracle/mycsv has to be physical location on disk.
2) grant read, write on directory MYCSV to scott;
3) Put your csv file on /home/oracle/mycsv at OS level
4) create table my_ext_table
(
ENAME VARCHAR2(10),
DNAME VARCHAR2(14),
JOB VARCHAR2(9)
)
organization external
(
type ORACLE_LOADER
default directory MY_DIR
access parameters
(
records delimited by newline
fields terminated by "~"
)
location ('myfile.csv')
)
reject limit unlimited;
To create this CSV File you may use following command
set pagesize 0 newpage 0 feedback off
select ENAME || '~' || DNAME || '~' || JOB from SCOTT.EMP, SCOTT.DEPT
WHERE EMP.DEPTNO=DEPT.DEPTNO;
spool /home/oracle/test_dir/myfile.csv
/
spool off
Updates
- Steps to import data from 11g to 9i database
- AWR vs ADDM vs ASH
- Advantages and Disadvantages of Datapump
- Oracle Database 12c New Features for Developers
- Unix for the DBA
- Oracle library cache tuning – A Real Case Study.
- Oracle Performance Tuning – AWR Queries
- Oracle DBA Silver Bullets – Performance Queries
- Script to find out Backups taken and their duration in last 24 hours
- Script to Compile all invalid Materialized Views in a schema
- Script to find out if any new table/procedure added in the schema in past 24 hours
- Find duplicate columns from all tables in a schema
- Difference b/w Oracle Restore and Recovery
- Enabling/Disabling Archivelog mode in Oracle
- Where is my Alert log file?
- Script to find out if Archlog Files backed up in last 24 Hours
- Keeping PL/SQL in Oracle Memory
- Oracle RMAN: Industry Standards & best practices for Stable/Reliable backups
- Oracle Data Guard : Synchronous vs. Asynchronous Redo Transport
- Compare Structures of Two Tables in Oracle
- Oracle: Query to find the 10 Largest Objects in DB
- Oracle Locks
- Script for Hidden Parameters
- Oracle RAC Basic
- Oracle: Query to find the 10 Largest Objects in DB
- Oracle: DBMS_STATS Gather Statistics of Schema, Tables, Indexes
- Create External Table from CSV File
- How to find long running query in oracle?
- Node evictions in RAC environment
- Recovering drop table using RMAN
- Writing DBA scripts :
- Oracle ASM Queries for DBA
- Reference summary of asmcmd commands
- RAW Device and ASM for Oracle Database Creation on Linux & Solaris Platform
- Copying Files and Directories commands for DBAs:
- Oracle Database Health check scripts
- Using ORA_ROWSCN and SCN_TO_TIMESTAMP to find the last updated date or timestamp of a record.
- How We Resolved the Account Locked (Timed) issue?
- Download Oracle 11g New Features PDF.
- Installing & Configuring Oracle ASM on Linux – Red Hat Enterprise Linux 4.0
- Creating a Recovery Catalog – RMAN in Oracle 10g
- Clone of a database on the same Host i.e. Server (Linux RHEL -4)
- Cloning and Refreshing an Oracle Database
- Group and User Creation in Solairs.
- How to check the Physical RAM and Swap Space in Unix/Linux Systems.
- Do not invoke SQL*Plus with a password On UNIX and Linux platforms.
- Setting an Oracle Environment variable – ORACLE_HOME
- How important is having Unix/Linux OS Knowledge for Oracle DBAs?
- Upgrade Oracle Database from 9.2.0.1 to 9.2.0.7 on Soalris 10 (Sun Sparc)
- Upgrading Oracle Database Server 10g Release 10.2.0.1 to Oracle Database 10g Release 10.2.0.3 on Linux/Fedora core 6
- Changing an Oracle Database Name in Oracle 10g
- All about the STATSPACK (Statistics Packages) in Oracle 8i, 9i & 10g
- How to perform a full database export using original export/import utility?
- Here are the simple steps to migrate the default Database Character Set:
- CSSCAN Utility and CSALTER Script:
- Background processes in RAC
- New features in Oracle 9i/10g/11g RAC
Create External Table from CSV File
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment