加一个大写的A的隐藏属性,可以让文件的access time属性不会变,用来减少磁盘的I/O(access time属性使用stat 命令去查看)
--注意:A属性对于再touch一次这个文件是无效的
=====================================
SQL>conn / as sysdbaspool /u01/chattr.sql
set heading off
set feedback off
select 'ho chattr +A '||member from v$logfile
union select 'ho chattr +A '||name from v$tempfile
union select 'ho chattr +A '||name from v$datafile
union select 'ho chattr +A '||name from v$controlfile;
set heading on
set feedback on
spool off
去掉没用的头尾几行
SQL> @/u01/chattr.sql[root@test1 orcl]# lsattr * -------A----- app_data.dbf
-------A----- control01.ctl
-------A----- control02.ctl
-------A----- control03.ctl
-------A----- example01.dbf
-------A----- redo01.log
-------A----- redo02.log
-------A----- redo03.log
-------A----- redo04.log
-------A----- sysaux01.dbf
-------A----- system01.dbf
-------A----- temp01.dbf
-------A----- undotbs01.dbf
-------A----- users01.dbf
SQL> startup[oracle@test1 orcl]$ stat system01.dbf File: `system01.dbf'
Size: 503324672 Blocks: 984024 IO Block: 4096 regular file
Device: 805h/2053d Inode: 2286198 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 500/ oracle) Gid: ( 501/oinstall)
Access: 2012-02-18 15:38:17.000000000 +0800
Modify: 2012-02-18 15:43:44.000000000 +0800
Change: 2012-02-18 15:43:44.000000000 +0800
SQL> shutdown immediate[oracle@test1 orcl]$ stat system01.dbf File: `system01.dbf'
Size: 503324672 Blocks: 984024 IO Block: 4096 regular file
Device: 805h/2053d Inode: 2286198 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 500/ oracle) Gid: ( 501/oinstall)
Access: 2012-02-18 15:38:17.000000000 +0800----时间与上面的状态相比不变
Modify: 2012-02-18 15:44:54.000000000 +0800
Change: 2012-02-18 15:44:54.000000000 +0800
定期在业务低峰期,用oracle用户对所有的文件,touch一次就可以更新Access time了
SQL>conn / as sysdbaspool /u01/touch.sql
set heading off
set feedback off
select 'ho touch '||member from v$logfile
union select 'ho touch '||name from v$tempfile
union select 'ho touch '||name from v$datafile
union select 'ho touch '||name from v$controlfile;
set heading on
set feedback on
spool off
去掉没用的头尾几行
SQL> @/u01/touch.sql
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26465805/viewspace-716711/
,如需转载,请注明出处,否则将追究法律责任。