-- 设置编辑器用vi打开,windows客户端可以换成NotePad define _editor=vi -- 设置dbms_output输出缓冲区大小 set serveroutput on size 1000000 -- 设置输出格式 set long 200 set linesize 500 set pagesize 9999 -- 去除重定向输出每行拖尾空格 set trimspool on -- 设置name列长 col Name format a80 -- 输出分隔符 set colsep '|' -- 显示脚本中的命令的执行结果 set termout off -- 查询当前实例名 col global_name new_value gname define gname=idle column global_name new_value gname selectlower(user) ||'@'|| substr( global_name, 1, decode( dot, 0, length(global_name), dot-1) ) global_name from (select global_name, instr(global_name,'.') dot from global_name ); set sqlprompt '&gname _DATE> ' -- 设置session时间格式 ALTER SESSION SET nls_date_format ='YYYY-MM-DD HH24:MI:SS'; set termout on
中文乱码
查看 Oracle 的字符集
1 2 3 4 5 6 7 8
SQL>select userenv('language') from dual; USERENV('LANGUAGE') ---------------------------------------------------- AMERICAN_AMERICA.ZHS16GBK SQL> exit; Disconnected from Oracle Database 11g Enterprise Edition Release11.2.0.4.0-64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining andReal Application Testing options
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 03-AUG-2023 07:54:41
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production Start Date 03-AUG-2023 07:53:15 Uptime 0 days 0 hr. 1 min. 25 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Default Service XE Listener Parameter File /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora Listener Log File /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/3abc9992f092/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=3abc9992f092)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=3abc9992f092)(PORT=8080))(Presentation=HTTP)(Session=RAW)) Services Summary... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "XE" has 1 instance(s). Instance "XE", status READY, has 1 handler(s) for this service... Service "XEXDB" has 1 instance(s). Instance "XE", status READY, has 1 handler(s) for this service... The command completed successfully