Please refer to oracle documentation for more details:
http://docs.oracle.com/cd/B19306_01/server.102/b14220/physical.htm
In here I will provide the simple script with batch file to create oracle tablespace.
So it will consist of 2 portion:
- Batch command file
- PLSQL script
Using both file, you'll have flexibility to create tablespace with specific parameter.
BATCH File
The first line on Batch command is sqlplus connection
sqlplus -s %1/%2@%3 @oracle_tablespace_create.sql %4 %5 %6
The Parameters:
1) [admin_user] = Username, with Administrative DB Privilages.
2) [admin_password] = Password Of The Above user.
3) [conn_str] = DB Connection String As In Tnsnames.ora .
4) [tablespace_name] = Tablespace name to be created.
5) [file_name] = Full path file name to be created.
6) [file_size] = File size (use M for Mb, K for Kb).
PLSQL Script
set echo on
set feedback on
set autoprint on
set serveroutput on size 20000
spool oracle_tablespace_create.log
prompt Creating tablespace &&1 into file: &&2 with size of &&3
CREATE TABLESPACE "&&1"
LOGGING
DATAFILE
'&&2' SIZE &&3
REUSE
EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO
/
spool off
EXIT;
How to use?
here how to use the script to create 1 GB tablespace:connection
oracle_tablespace_create.bat system password <conn_string> MY_TBS C:\APP\HPSWADM\ORADATA\<SID>\MY_TBS_01.DBF 1024M
Tidak ada komentar:
Posting Komentar