查看nls参数
select * from nls_database_parameters
select * from nls_instance_parameters
select * from nls_session_parameters
修改nls参数
alter session set nls_date_format = 'YYYY-MM-DD'
alter instance ...
alter database ...
select * from nls_database_parameters
select * from nls_instance_parameters
select * from nls_session_parameters
修改nls参数
alter session set nls_date_format = 'YYYY-MM-DD'
alter instance ...
alter database ...
NLS_DATE_FORMAT = yyyy-mm-dd hh24:mi:ss ,显示的效果是 2003-7-5 10:31
alter session set nls_date_format = 'YYYY-MM-DD'
alter instance ...
alter database ...能不能写的详细点,我是菜鸟
通过命令行进行修改:
Setting or Changing Initialization Parameter Values
Use the SET clause of the ALTER SYSTEM statement to set or change initialization
parameter values. Additionally, the SCOPE clause specifies the scope of a change as
described in the following table:
Managing Initialization Parameters Using a Server Parameter File
2-48 Oracle9 i Database Administrator’s Guide
It is an error to specify SCOPE=SPFILE or SCOPE=BOTH if the server is not using a
server parameter file. The default is SCOPE=BOTH if a server parameter file was
used to start up the instance, and MEMORY if a traditional initialization parameter
file was used to start up the instance.
For dynamic parameters, you can also specify the DEFERRED keyword. When
specified, the change is effective only for future sessions.
A COMMENT clause allows a comment string to be associated with the parameter
update. When you specify SCOPE as SPFILE or BOTH, the comment is written to the
server parameter file.
The following statement changes the maximum number of job queue processes
allowed for the instance. It also specifies a comment, and explicitly states that the
change is to be made only in memory (that is, it is not persistent across instance
shutdown and startup).
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=50
COMMENT='temporary change on Nov 29'
SCOPE=MEMORY;
SCOPE Clause Description
SCOPE = SPFILE The change is applied in the server parameter file only. The
effect is as follows:
n For dynamic parameters, the change is effective at the next
startup and is persistent.
n For static parameters, the behavior is the same as for
dynamic parameters. This is the only SCOPE specification
allowed for static parameters.
SCOPE = MEMORY The change is applied in memory only. The effect is as follows:
n For dynamic parameters, the effect is immediate, but it is
not persistent because the server parameter file is not
updated.
n For static parameters, this specification is not allowed.
SCOPE = BOTH The change is applied in both the server parameter file and
memory. The effect is as follows:
n For dynamic parameters, the effect is immediate and
persistent.
n For static parameters, this specification is not allowed.
1)修改init$instance.ora
2)用create spfile命令生成 spfile
example1:生成默认的 spfile
CREATE SPFILE FROM PFILE='/u01/oracle/dbs/init.ora';
example2:指定生成的spfile的确名称
CREATE SPFILE='/u01/oracle/dbs/test_spfile.ora'
FROM PFILE='/u01/oracle/dbs/test_init.ora';
create or replace trigger data_logon_trigger
after logon
ON DATABASE
begin
execute immediate
'alter session set nls_date_format = ''yyyy-mm-dd hh24:mi:ss'' ';
end;
大哥,我前面不是说了,不管你怎么规定格式,数据库存到数据文件中的日期格式都是一样,你设置这个环境变量只是为了显示时间的时候按照你规定的方式显示而已,所以,你写这个trigger没有必要,你只要在你需要在oracle的客户端设置这个变量就可以了
你可能不了解情况,我设置的目的不是为了显示,而是为了客户端(javascript)传递日期型参数