oracle 11g 常用命令

Posted 101.key

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle 11g 常用命令相关的知识,希望对你有一定的参考价值。

sqlplus system/[email protected];

查看oracle字符集:
select * from nls_database_parameters where parameter =‘NLS_CHARACTERSET‘;

C、server端字符集修改 


***************************************************************** 


*  更改字符集步骤方法(WE8ISO8859P1 --> ZHS16GBK)            * 


***************************************************************** 


SQL> 

将数据库启动到RESTRICTED模式下做字符集更改: 

SQL> conn /as sysdba 

Connected. 

SQL> shutdown immediate; 

Database closed. 

Database dismounted. 

ORACLE instance shut down. 

SQL> startup mount 

ORACLE instance started. 

Total System Global Area  236000356 bytes 

Fixed Size                   451684 bytes 

Variable Size             201326592 bytes 

Database Buffers           33554432 bytes 

Redo Buffers                 667648 bytes 

Database mounted. 

SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION; 

System altered. 

SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0; 

System altered. 

SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0; 

System altered. 

SQL> alter database open; 

Database altered. 

SQL> ALTER DATABASE CHARACTER SET ZHS16GBK; 

ALTER DATABASE CHARACTER SET ZHS16GBK 

* 

ERROR at line 1: 

ORA-12712: new character set must be a superset of old character set 


提示我们的字符集:新字符集必须为旧字符集的超集,这时我们可以跳过超集的检查做更改: 

SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK; 

Database altered. 

SQL> select * from v$nls_parameters; 

略 

19 rows selected. 

重启检查是否更改完成: 

SQL> shutdown immediate; 

Database closed. 

Database dismounted. 

ORACLE instance shut down. 

SQL> startup 

ORACLE instance started. 

Total System Global Area  236000356 bytes 

Fixed Size                   451684 bytes 

Variable Size             201326592 bytes 

Database Buffers           33554432 bytes 

Redo Buffers                 667648 bytes 

Database mounted. 

Database opened. 

SQL> select * from v$nls_parameters; 

略 

19 rows selected. 

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 


D、client端字符集修改 


在 /home/oracle与 /root用户目录下的.bash_profile中 


添加或修改 export NLS_LANG="AMERICAN_AMERICA.UTF8" 语句 


关闭当前ssh窗口。 


drop tablespace TS_DATA including contents and datafiles;

create tablespace TS_DATA logging  
datafile ‘D:\tablespace\TS_DATA.dbf‘
size 50m  
autoextend on  
next 50m maxsize 20480m  
extent management local; 

drop user user1 cascade;

create user user1 identified by 123456 default tablespace TS_DATA;
grant connect,resource to user1;
grant dba to user1;
spool off;

create directory dpDir as ‘d:\dump‘;
grant read,write on directory dpDir to user1;

DOS直接执行:
expdp user1/123456 directory=dpDir  dumpfile=user120170505.dmp logfile=user120170505.log PARALLEL=4;

拷贝数据库文件和日志文件到这个目录:  D:\app\thinkpad\admin\orcl\dpdump 后执行以下命令:
impdp user1/[email protected] file=USER120170505.DMP log=user120170505.log

 

以上是关于oracle 11g 常用命令的主要内容,如果未能解决你的问题,请参考以下文章

从Oracle存储过程Oracle 11g发送邮件

(总结)Oracle 11g用户表空间权限常用管理命令

Oracle基础维护01-常用管理命令总结

Oracle11g Oracle11g_数据库简介

Oracle11g常用数据字典(转)

Oracle 11g R2 常用配置与日志的文件位置