background preloader

Oracle

Facebook Twitter

Oracle Shell Scripting. This article presents some basic techniques for creating Windows batch files and UNIX/Linux shell scripts that connect to SQL*Plus and RMAN.

Oracle Shell Scripting

Windows To run an SQL script using SQL*Plus, place the SQL along with any SQL*Plus commands in a file and save it on your operating system. For example, save the following script in a file called "C:\emp.sql". CONNECT scott/tiger SPOOL C:\emp.lst SET LINESIZE 100 SET PAGESIZE 50 SELECT * FROM emp; SPOOL OFF EXIT; Next, create a batch file called "C:\get_emp.bat" containing the following command. sqlplus /nolog @C:\emp.sql The resulting batch file can be run manually, by double-clicking on it, or scheduled using the Scheduled Tasks Wizard (Start > Programs > Accessories > System Tools > Scheduled Tasks) or the AT scheduler.

The method is very similar when using Recovery Manager (RMAN). Next create a batch file called "C:\backup.bat" containing the following command. rman target=/ @cmdfile.txt UNIX and Linux (Method 1) #! Chmod u+x /u01/get_emp.ksh #! #! #! Contents. Import full object exclude certain table from (*.dmp) - Oracle DBA Forums. IMPDP EXCLUDE TABLES - Oracle DBA Forums. QUOTE (Carol @ Jul 7 2009, 12:14 PM) This would help if I wanted to exclude all data from all tables. Or wanted to exclude certain tables completely. But I am not seeing a way to exclude only the data from a subset of tables. I need all the objects, with theexception of no data in a subset of the tables.Will I be doing a query=<schema>. <table>:'"where rownum<1"' ? Or query='"where table in ('tab1','tab2','tab3') and rownum <1"' I guess I have to go test with this, was hoping I would't have to reinvent a wheel.

Thanks hi i hope you got the answer for you r Question...if not just look at below code Windows: D:\> expdp username/password DIRECTORY=my_dir DUMPFILE=exp_tab.dmp LOGFILE=exp_tab.log EXCLUDE=TABLE:\”IN (’EMP’, ‘DEP’)\” Import one table from full export dump - Oracle DBA Forums. 2 Data Pump Export. This chapter describes the Oracle Data Pump Export utility. The following topics are discussed: This section provides descriptions of the parameters available in the command-line mode of Data Pump Export. Many of the descriptions include an example of how to use the parameter. Using the Export Parameter Examples If you try running the examples that are provided for each parameter, be aware of the following requirements: Most of the examples use the sample schemas of the seed database, which is installed by default when you install Oracle Database.

If necessary, ask your DBA for help in creating these directory objects and assigning the necessary privileges and roles. Syntax diagrams of these parameters are provided in Syntax Diagrams for Data Pump Export. Unless specifically noted, these parameters can also be specified in a parameter file. Oracle Tablespaces. Create table t_contig_space ( tablespace_name VARCHAR2(30), file_id NUMBER, block_id NUMBER, starting_file_id NUMBER, starting_block_id NUMBER, blocks NUMBER, bytes NUMBER) tablespace uwdata; CREATE OR REPLACE VIEW v_contig_space AS SELECT SUBSTR(tablespace_name,1,20) TABLESPACE_NAME, starting_file_id, starting_block_id, SUM (blocks) sum_blocks, COUNT(blocks) count_blocks, MAX(blocks) max_blocks, SUM (bytes)/1024/1024 SUM_MB FROM tl_contig_space GROUP BY tablespace_name, starting_file_id, starting_block_id; DECLARE CURSOR query IS SELECT * FROM dba_free_space ORDER BY tablespace_name, file_id, block_id; this_row query%ROWTYPE; previous_row query%ROWTYPE; old_file_id PLS_INTEGER; old_block_id PLS_INTEGER; BEGIN OPEN query; FETCH query INTO this_row; previous_row := this_row; old_file_id := previous_row.file_id; old_block_id := previous_row.block_id;

Oracle Tablespaces