Sie sind auf Seite 1von 7

SQL*Plus: Release 10.1.0.2.0 - Production on Mer. Nov.

16 20:57:52 2016
Copyright (c) 1982, 2004, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> desc dba_tablespaces
Name Null? Type
----------------------------------------- -------- ----------------------------
TABLESPACE_NAME NOT NULL VARCHAR2(30)
BLOCK_SIZE NOT NULL NUMBER
INITIAL_EXTENT NUMBER
NEXT_EXTENT NUMBER
MIN_EXTENTS NOT NULL NUMBER
MAX_EXTENTS NUMBER
PCT_INCREASE NUMBER
MIN_EXTLEN NUMBER
STATUS VARCHAR2(9)
CONTENTS VARCHAR2(9)
LOGGING VARCHAR2(9)
FORCE_LOGGING VARCHAR2(3)
EXTENT_MANAGEMENT VARCHAR2(10)
ALLOCATION_TYPE VARCHAR2(9)
PLUGGED_IN VARCHAR2(3)
SEGMENT_SPACE_MANAGEMENT VARCHAR2(6)
DEF_TAB_COMPRESSION VARCHAR2(8)
RETENTION VARCHAR2(11)
BIGFILE VARCHAR2(3)
SQL> select tablespace_name from dba_tablespaces
2 ;
TABLESPACE_NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
TEMP
USERS
EXAMPLE
6 rows selected.
SQL> create table space ts1
2 datafile'e:\ts1.dbf'
3 size 10M;
create table space ts1
*
ERROR at line 1:
ORA-00922: missing or invalid option

SQL> create tablespace ts1


2 datafile 'e:\tbl1.dbf'
3 size 10M;
Tablespace created.
SQL> create tablespace ts2
2 datefile 'e:\tbl2.dbf'
3 size 10 M
4 autoextend on next 300K maxsize 20M;
datefile 'e:\tbl2.dbf'
*
ERROR at line 2:
ORA-02180: invalid option for CREATE TABLESPACE

SQL> create tablespace ts2


2 datafile'e:\tbl2.dbf'
3 size 10M
4 autoextend on next 20K maxsize 20M;
Tablespace created.
SQL> desc dba_segments
Name Null? Type
----------------------------------------- -------- ----------------------------
OWNER VARCHAR2(30)
SEGMENT_NAME VARCHAR2(81)
PARTITION_NAME VARCHAR2(30)
SEGMENT_TYPE VARCHAR2(18)
TABLESPACE_NAME VARCHAR2(30)
HEADER_FILE NUMBER
HEADER_BLOCK NUMBER
BYTES NUMBER
BLOCKS NUMBER
EXTENTS NUMBER
INITIAL_EXTENT NUMBER
NEXT_EXTENT NUMBER
MIN_EXTENTS NUMBER
MAX_EXTENTS NUMBER
PCT_INCREASE NUMBER
FREELISTS NUMBER
FREELIST_GROUPS NUMBER
RELATIVE_FNO NUMBER
BUFFER_POOL VARCHAR2(7)
SQL> select tablespace_name from dba_segments where segment_name='DEPT';
TABLESPACE_NAME
------------------------------
USERS
SQL> alter tablespace USERS read only;
Tablespace altered.
SQL> alter tablespace USERS read write;
Tablespace altered.
SQL> alter tablespace USERS offline;
Tablespace altered.
SQL> alter tablespace USERS online;
Tablespace altered.
SQL> alter tablespace TS1 offline;
Tablespace altered.
SQL> alter tablespace TS
2
SQL> alter tablespace ts1
2 rename datafile 'e:\tbl1.dbf'
3 to
4 'C:\zhd1\TBL1.DBF';
Tablespace altered.
SQL> alter database ts1 online;
alter database ts1 online
*
ERROR at line 1:
ORA-02231: missing or invalid option to ALTER DATABASE

SQL> alter tablespace ts1 online;


Tablespace altered.
SQL> desc dba_data_file
ERROR:
ORA-04043: object dba_data_file does not exist

SQL> desc dba_data_files


Name Null? Type
----------------------------------------- -------- ----------------------------
FILE_NAME VARCHAR2(513)
FILE_ID NUMBER
TABLESPACE_NAME VARCHAR2(30)
BYTES NUMBER
BLOCKS NUMBER
STATUS VARCHAR2(9)
RELATIVE_FNO NUMBER
AUTOEXTENSIBLE VARCHAR2(3)
MAXBYTES NUMBER
MAXBLOCKS NUMBER
INCREMENT_BY NUMBER
USER_BYTES NUMBER
USER_BLOCKS NUMBER
SQL> select file_name from dba_data_files where tablespace_name='USERS';
FILE_NAME
--------------------------------------------------------------------------------
E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\USERS01.DBF
SQL> alter tablespace USERS offline;
Tablespace altered.
SQL> alter tablespace USERS
2 rename datafile 'E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\USERS01.DBF'
3 to
4 'C:\zhd1\TBL1.DBF';
alter tablespace USERS
*
ERROR at line 1:
ORA-01525: error in renaming data files
ORA-01523: cannot rename data file to 'C:\zhd1\TBL1.DBF' - file already part of
database

SQL> alter tablespace USERS


2 rename datafile 'E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\USERS01.DBF'
3 to
4 'alter tablespace USERS
5 rename datafile 'E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\USERS01.DBF'
6
SQL> alter tablespace USERS
2 rename datafile 'E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\USERS01.DBF'
3 to 'C:\DATA_FILE\USERS01.DBF';
Tablespace altered.
SQL> alter tablespace USERS ONLINE;
Tablespace altered.
SQL> select file_name from dba_data_files where tablespace_name='USERS';
FILE_NAME
--------------------------------------------------------------------------------
C:\DATA_FILE\USERS01.DBF
SQL> select file_name from dba_data_files where tablespace_name='SYSTEM';
FILE_NAME
--------------------------------------------------------------------------------
E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\SYSTEM01.DBF
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145750508 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.
SQL> alter database
2 raname file 'E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\SYSTEM01.DBF'
3 to
4 'C:\ts_system\SYSTEM01.DBF';
raname file 'E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\SYSTEM01.DBF'
*
ERROR at line 2:
ORA-02231: missing or invalid option to ALTER DATABASE

SQL> alter database


2 rename file 'E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\SYSTEM01.DBF'
3 to
4 ''C:\ts_system\SYSTEM01.DBF';
''C:\ts_system\SYSTEM01.DBF'
*
ERROR at line 4:
ORA-00933: SQL command not properly ended

SQL> alter database


2 rename file 'E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\SYSTEM01.DBF'
3 to
4 'C:\ts_system\SYSTEM01.DBF';
Database altered.
SQL> alter database open
2 ;
Database altered.
SQL> select file_name from dba_data_files where tablespace_name='SYSTEM';
FILE_NAME
--------------------------------------------------------------------------------
C:\TS_SYSTEM\SYSTEM01.DBF
SQL> create tablespace ts3
2 datafile 'e:\f1.dbf' size 5M autoextend on next 1M maxsize 10M,'e:\f2.dbf'
size 5M autoextend o

SQL>
SQL> create tablespace ts3
2 datafile 'e:\f1.dbf' size 5M autoextend on next 1M maxsize 10M,
3 'e:\f2.dbf' size 5M autoextend on next 1M maxsize 10M
4 extent management local uniform size 200K;
Tablespace created.
SQL> alter tablespace ts3 offline;
Tablespace altered.
SQL> alter tablespace ts3
2 rename datafile 'e:\f1.dbf','e:\f2.dbf' to 'F:\sauve\F1.DBF','F:\sauve\F2.D
BF';
Tablespace altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145750508 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.
Database opened.
SQL> alter tablespace ts3 offline;
alter tablespace ts3 offline
*
ERROR at line 1:
ORA-01539: tablespace 'TS3' is not online

SQL> alter tablespace ts3 online;


Tablespace altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145750508 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: 'F:\SAUVE\F1.DBF'

SQL> shutdown immediate


ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145750508 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.
Database opened.
SQL> desc dba_tablespaces
Name Null? Type
----------------------------------------- -------- ----------------------------
TABLESPACE_NAME NOT NULL VARCHAR2(30)
BLOCK_SIZE NOT NULL NUMBER
INITIAL_EXTENT NUMBER
NEXT_EXTENT NUMBER
MIN_EXTENTS NOT NULL NUMBER
MAX_EXTENTS NUMBER
PCT_INCREASE NUMBER
MIN_EXTLEN NUMBER
STATUS VARCHAR2(9)
CONTENTS VARCHAR2(9)
LOGGING VARCHAR2(9)
FORCE_LOGGING VARCHAR2(3)
EXTENT_MANAGEMENT VARCHAR2(10)
ALLOCATION_TYPE VARCHAR2(9)
PLUGGED_IN VARCHAR2(3)
SEGMENT_SPACE_MANAGEMENT VARCHAR2(6)
DEF_TAB_COMPRESSION VARCHAR2(8)
RETENTION VARCHAR2(11)
BIGFILE VARCHAR2(3)
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
TEMP
USERS
EXAMPLE
TS1
TS2
TS3
9 rows selected.
SQL> alter tablespace ts3 offline;
Tablespace altered.
SQL> drop tablespace ts3;

Das könnte Ihnen auch gefallen