SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'DBA01_2002';
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'DBA01_2003';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
DBA01_2003 /u02/oradata/orcl/users_2003.dbf 500
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'DBA01_2004';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
DBA01_2004 /u02/oradata/orcl/users_2004.dbf 500
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'DBA01_2005';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
DBA01_2005 /u02/oradata/orcl/users_2005.dbf 1024
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'DBA01_2006';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
DBA01_2006 /u02/oradata/orcl/users_2006.dbf 1024
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'DBA01_2007';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
DBA01_2007 /u02/oradata/orcl/users_2007.dbf 1024
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'DBA01_2008';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
DBA01_2008 /u02/oradata/orcl/users_2008.dbf 1024
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'DBA01_2009';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
DBA01_2009 /u02/oradata/orcl/users_2009.dbf 1024
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'DBA01_2010';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
DBA01_2010 /u02/oradata/orcl/users_2010.dbf 1024
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'DBA01_2011';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
DBA01_2011 /u02/oradata/orcl/users_2011.dbf 1024
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'INDX';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
INDX /u02/oradata/orcl/indx01.dbf 10240
INDX /u02/oradata/orcl/indx02.dbf 20480
INDX /u02/oradata/orcl/indx03.dbf 23808
INDX /u02/oradata/orcl/indx04.dbf 23808
INDX /u02/oradata/orcl/indx05.dbf 20480
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'USERS';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
USERS /u02/oradata/orcl/users01.dbf 30720
USERS /u02/oradata/orcl/users02.dbf 30720
USERS /u02/oradata/orcl/users03.dbf 30720
SQL> SELECT TABLESPACE_NAME ,FILE_NAME, BYTES/1024/1024 SIZE_M from dba_data_files WHERE TABLESPACE_NAME = 'SYSAUX';
TABLESPACE FILE_NAME SIZE_M
---------- ---------------------------------------- ----------
SYSAUX /u02/oradata/orcl/sysaux01.dbf 27080.9375
三.根据以上文件分别建立表空间
1.先扩大本身的user01.dbf的空间
SQL>alter database datafile '/opt/oracle/oradata/orcl/users01.dbf' resize 30G;
2.再增加数据文件
SQL>alter tablespace users add datafile '/opt/oracle/oradata/orcl/users02.dbf' size 30G;
SQL>alter tablespace users add datafile '/opt/oracle/oradata/orcl/users03.dbf' size 30G;
3.创建索引表空间
SQL>create tablespace INDX datafile '/opt/oracle/oradata/orcl/indx01.dbf' size 30G;
SQL>alter tablespace INDX add datafile '/opt/oracle/oradata/orcl/indx02.dbf' size 30G;
SQL>alter tablespace INDX add datafile '/opt/oracle/oradata/orcl/indx03.dbf' size 30G;
其它表空间
create tablespace DBA01_2001 datafile '/opt/oracle/oradata/orcl/users_2001.dbf' size 500M;
create tablespace DBA01_2002 datafile '/opt/oracle/oradata/orcl/users_2002.dbf' size 500M;
create tablespace DBA01_2003 datafile '/opt/oracle/oradata/orcl/users_2003.dbf' size 500M;
create tablespace DBA01_2004 datafile '/opt/oracle/oradata/orcl/users_2004.dbf' size 500M;
create tablespace DBA01_2005 datafile '/opt/oracle/oradata/orcl/users_2005.dbf' size 500M;
create tablespace DBA01_2006 datafile '/opt/oracle/oradata/orcl/users_2006.dbf' size 500M;
create tablespace DBA01_2007 datafile '/opt/oracle/oradata/orcl/users_2007.dbf' size 500M;
create tablespace DBA01_2008 datafile '/opt/oracle/oradata/orcl/users_2008.dbf' size 500M;
create tablespace DBA01_2009 datafile '/opt/oracle/oradata/orcl/users_2009.dbf' size 500M;
create tablespace DBA01_2010 datafile '/opt/oracle/oradata/orcl/users_2010.dbf' size 500M;
create tablespace DBA01_2011 datafile '/opt/oracle/oradata/orcl/users_2011.dbf' size 500M;
建立目录:以SYS管理登录
sql> create directory expdir as '/opt/oracle/oradata/orcl';
一。授权用户
sql> grant EXP_FULL_DATABASE to orauser
sql> grant IMP_FULL_DATABASE to orauser
注意:
针对大数据库导入时,遇到了 由于db_recovery_file_dest_size=4G (太小),导致不能写日志,导入过程停在那里了。
通过
SQL> alter system set db_recovery_file_dest_size =50G scope=both来设置。--调大
在linux命令窗口以 oracle用户登录
导入
# impdp orauser/password directory=expdir dumpfile=data.dmp logfile=exp.log full=y
#单张表。如果表已经存在则要先删除
impdp 用户名/密码 TABLES= DIRECTORY=expdir DUMPFILE=data.dmp
导出:
# expdp orauser/password directory=expdir compression=ALL dumpfile=data.dmp full=y logfile=exp.log