关于oracle数据库日期格式的设定

select 'DATABASE', value 
from nls_database_parameters 
where parameter = 'NLS_DATE_FORMAT'
union
select 'INSTANCE', value 
from nls_instance_parameters
where parameter = 'NLS_DATE_FORMAT'
union
select 'SESSION', value 
from nls_session_parameters
where parameter = 'NLS_DATE_FORMAT';

 

说明:

1)Database nls cannot be changed after database installation.
2)Instance nls can be changed by:
alter system set nls_date_format='YYYY-MM-DD HH24:MI:SS' scope=spfile; and then restart instance.
3)Session nls can be changed by:
alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS'; This take effect immediate but not a permanent change, effect will terminate when session exit.

 

permanent change can be changed in client side:

1)   In Windows, add NLS_DATE_FORMAT in environment variable:
我的电脑 属性 高级 环境变量 新建 变量名 NLS_DATE_FORMAT 变量值 YYYY-MM-DD HH24:MI:SS 应用 确定

 

2)   In Linux/Unix
vi .bash_profile
add:
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
. .bash_profile

设置前
SQL> select sysdate from dual;

SYSDATE
-------------------
2008-12-30

设置后
SQL> select sysdate from dual;

SYSDATE
-------------------
2008-12-30 14:09:01

RMAN list backup 也会显示备份集生成的具体时间

你可能感兴趣的:(关于oracle数据库日期格式的设定)