- unix/
- 我想要所有的记录,直到文件结束,这些记录在unix中大于给定的日期
我想要所有的记录,直到文件结束,这些记录在unix中大于给定的日期
我想要所有的记录,直到文件结束,这些记录在unix中大于给定的日期,unix,Unix,我要所有的记录,直到日志文件的结尾,这是大于给定日期。。。
假设给定的日期是2015年12月14日星期一22:00:03,那么我希望日志文件中的所有行,直到找到第一个大于此日期的行为止
例如:awk“{if($0>“2015年12月15日星期二08:00:00”)print}”file.out
只打印大于日期的行,但我要匹配后的所有行,直到文件结束
请注意
1.我不能使用正则表达式,因为我不知道日志文件中是否存在该日期的条目,即H:M:S,所以我必须使用大于日期的功能
lg文件的每一行上都没
我要所有的记录,直到日志文件的结尾,这是大于给定日期。。。
假设给定的日期是2015年12月14日星期一22:00:03,那么我希望日志文件中的所有行,直到找到第一个大于此日期的行为止
例如:awk“{if($0>“2015年12月15日星期二08:00:00”)print}”file.out
- 只打印大于日期的行,但我要匹配后的所有行,直到文件结束
请注意
1.我不能使用正则表达式,因为我不知道日志文件中是否存在该日期的条目,即H:M:S,所以我必须使用大于日期的功能
lg文件的每一行上都没有日期。它介于两者之间,但在新的线路上
请帮忙
示例日志文件:::
Mon Dec 14 02:00:00 2015
Clearing Resource Manager plan via parameter
Mon Dec 14 07:02:57 2015
***********************************************************************
Fatal NI connect error 12504, connecting to:
(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=)(CID=(PROGRAM=oracle)(HOST=ltest8)(USER=oracle)))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.115)(PORT=1521)))
VERSION INFORMATION:
TNS for Linux: Version 11.1.0.6.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.1.0.6.0 - Production
Time: 14-DEC-2015 07:02:57
Tracing not turned on.
Tns error struct:
ns main err code: 12564
TNS-12564: TNS:connection refused
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
Mon Dec 14 08:01:37 2015
***********************************************************************
Fatal NI connect error 12504, connecting to:
(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=)(CID=(PROGRAM=oracle)(HOST=ltest8)(USER=oracle)))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.115)(PORT=1521)))
VERSION INFORMATION:
TNS for Linux: Version 11.1.0.6.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.1.0.6.0 - Production
Time: 14-DEC-2015 08:01:37
Tracing not turned on.
Tns error struct:
ns main err code: 12564
TNS-12564: TNS:connection refused
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
Mon Dec 14 08:54:33 2015
***********************************************************************
Fatal NI connect error 12504, connecting to:
(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=)(CID=(PROGRAM=oracle)(HOST=ltest8)(USER=oracle)))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.115)(PORT=1521)))
VERSION INFORMATION:
TNS for Linux: Version 11.1.0.6.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.1.0.6.0 - Production
Time: 14-DEC-2015 08:54:33
Tracing not turned on.
Tns error struct:
ns main err code: 12564
TNS-12564: TNS:connection refused
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
Mon Dec 14 08:57:18 2015
Thread 1 advanced to log sequence 232
Current log# 2 seq# 232 mem# 0: /u04/app/oracle/oradata/kcom/redo02.log
Mon Dec 14 08:57:19 2015
Errors in file /u01/app/oracle/diag/rdbms/kcom/Rialto/trace/Rialto_arc3_3953.trc:
ORA-19815: WARNING: db_recovery_file_dest_size of 268435456 bytes is 100.00% used, and has 0 remaining bytes available.
************************************************************************
You have following choices to free up space from flash recovery area:
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
then consider changing RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMAN
BACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to
reflect the new space.
4. Delete unnecessary files using RMAN DELETE command. If an operating
system command was used to delete files, then use RMAN CROSSCHECK and
DELETE EXPIRED commands.
************************************************************************
Mon Dec 14 09:17:45 2015
***********************************************************************
Fatal NI connect error 12504, connecting to:
(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=)(CID=(PROGRAM=oracle)(HOST=ltest8)(USER=oracle)))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.115)(PORT=1521)))
VERSION INFORMATION:
TNS for Linux: Version 11.1.0.6.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.1.0.6.0 - Production
Time: 14-DEC-2015 09:17:45
Tracing not turned on.
Tns error struct:
ns main err code: 12564
TNS-12564: TNS:connection refused
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
Mon Dec 14 10:25:24 2015
QKSRC: ViewText[ecode=942] = SELECT /*+ result_cache */ ID, 'PLUGIN_'||NAME AS NAME, STANDARD_ATTRIBUTES, SQL_MIN_COLUMN_COUNT, NVL(SQL_MAX_COLUMN_COUNT, 999) AS SQL_MAX_COLUMN_COUNT, SQL_EXAMPLES FROM WWV_FLOW_PLUGINS WHERE FLOW_ID = :B2 AND PLUGIN_TYPE = :B1
Mon Dec 14 14:31:14 2015
Thread 1 advanced to log sequence 233
Current log# 3 seq# 233 mem# 0: /u04/app/oracle/oradata/kcom/redo03.log
Mon Dec 14 14:31:15 2015
Errors in file /u01/app/oracle/diag/rdbms/kcom/Rialto/trace/Rialto_arc0_3947.trc:
ORA-19815: WARNING: db_recovery_file_dest_size of 268435456 bytes is 100.00% used, and has 0 remaining bytes available.
************************************************************************
You have following choices to free up space from flash recovery area:
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
then consider changing RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMAN
BACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to
reflect the new space.
4. Delete unnecessary files using RMAN DELETE command. If an operating
system command was used to delete files, then use RMAN CROSSCHECK and
DELETE EXPIRED commands.
************************************************************************
Mon Dec 14 20:28:23 2015
Thread 1 advanced to log sequence 234
Current log# 4 seq# 234 mem# 0: /u04/app/oracle/oradata/kcom/redo04.log
Mon Dec 14 20:28:24 2015
Errors in file /u01/app/oracle/diag/rdbms/kcom/Rialto/trace/Rialto_arc1_3949.trc:
ORA-19815: WARNING: db_recovery_file_dest_size of 268435456 bytes is 100.00% used, and has 0 remaining bytes available.
************************************************************************
You have following choices to free up space from flash recovery area:
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
then consider changing RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMAN
BACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to
reflect the new space.
4. Delete unnecessary files using RMAN DELETE command. If an operating
system command was used to delete files, then use RMAN CROSSCHECK and
DELETE EXPIRED commands.
************************************************************************
Mon Dec 14 22:00:00 2015
Setting Resource Manager plan SCHEDULER[0x2C09]:DEFAULT_MAINTENANCE_PLAN via scheduler window
Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter
Mon Dec 14 22:00:03 2015
Mon Dec 14 22:00:03 2015
Logminer Bld: Lockdown Complete. DB_TXN_SCN is UnwindToSCN (LockdownSCN) is 18957974
Tue Dec 15 02:00:00 2015
Clearing Resource Manager plan via parameter
Tue Dec 15 02:00:02 2015
2015年12月14日星期一02:00:00
通过参数清除资源管理器计划
2015年12月14日星期一07:02:57
***********************************************************************
致命的NI连接错误12504,连接到:
(描述=(连接数据=(服务名称=)(CID=(程序=oracle)(主机=ltest8)(用户=oracle))(地址=(协议=TCP)(主机=192.168.1.115)(端口=1521)))
版本信息:
TNS for Linux:11.1.0.6.0版-生产
Linux的TCP/IP NT协议适配器:版本11.1.0.6.0-生产
时间:2015年12月14日07:02:57
跟踪未打开。
Tns错误结构:
ns主错误代码:12564
TNS-12564:TNS:连接被拒绝
ns次要错误代码:0
nt主错误代码:0
nt次要错误代码:0
nt操作系统错误代码:0
2015年12月14日星期一08:01:37
***********************************************************************
致命的NI连接错误12504,连接到:
(描述=(连接数据=(服务名称=)(CID=(程序=oracle)(主机=ltest8)(用户=oracle))(地址=(协议=TCP)(主机=192.168.1.115)(端口=1521)))
版本信息:
TNS for Linux:11.1.0.6.0版-生产
Linux的TCP/IP NT协议适配器:版本11.1.0.6.0-生产
时间:2015年12月14日08:01:37
跟踪未打开。
Tns错误结构:
ns主错误代码:12564
TNS-12564:TNS:连接被拒绝
ns次要错误代码:0
nt主错误代码:0
nt次要错误代码:0
nt操作系统错误代码:0
2015年12月14日星期一08:54:33
***********************************************************************
致命的NI连接错误12504,连接到:
(描述=(连接数据=(服务名称=)(CID=(程序=oracle)(主机=ltest8)(用户=oracle))(地址=(协议=TCP)(主机=192.168.1.115)(端口=1521)))
版本信息:
TNS for Linux:11.1.0.6.0版-生产
Linux的TCP/IP NT协议适配器:版本11.1.0.6.0-生产
时间:2015年12月14日08:54:33
跟踪未打开。
Tns错误结构:
ns主错误代码:12564
TNS-12564:TNS:连接被拒绝
ns次要错误代码:0
nt主错误代码:0
nt次要错误代码:0
nt操作系统错误代码:0
2015年12月14日星期一08:57:18
线程1前进到日志序列232
当前日志#2 seq#232 mem#0:/u04/app/oracle/oradata/kcom/redoo2.log
2015年12月14日星期一08:57:19
文件/u01/app/oracle/diag/rdbms/kcom/Rialto/trace/Rialto_arc3_3953.trc中存在错误:
ORA-19815:警告:268435456字节的db_recovery_file_dest_大小已被100.00%使用,剩余可用字节为0。
************************************************************************
您可以使用以下选项从闪存恢复区域释放空间:
1.考虑改变RMAN保留策略。如果您使用的是Data Guard,
然后考虑更改RMAN归档删除策略。
2.使用RMAN将文件备份到第三设备,如磁带
备份恢复区域命令。
3.添加磁盘空间并将db\u recovery\u file\u dest\u size参数增加到
反映新的空间。
4.使用RMAN Delete命令删除不必要的文件。如果一个运营商
系统命令用于删除文件,然后使用RMAN交叉检查和
删除过期的命令。
************************************************************************
2015年12月14日星期一09:17:45
***********************************************************************
致命的NI连接错误12504,连接到:
(描述=(连接数据=(服务名称=)(CID=(程序=oracle)(主机=ltest8)(用户=oracle))(地址=(协议=TCP)(主机=192.168.1.115)(端口=1521)))
版本信息:
TNS for Linux:11.1.0.6.0版-生产
Linux的TCP/IP NT协议适配器:版本11.1.0.6.0-生产
时间:2015年12月14日09:17:45
跟踪未打开。
Tns错误结构:
ns主错误代码:12564
TNS-12564:TNS:连接被拒绝
ns次要错误代码:0
nt主错误代码:0
nt次要错误代码:0
nt操作系统错误代码:0
2015年12月14日星期一10:25:24
QKSRC:ViewText[ecode=942]=SELECT/*+result\u cache*/ID,“PLUGIN\u'\124; NAME作为名称,标准属性,SQL\u MIN\u COLUMN\u COUNT,NVL(SQL\u MAX\u COLUMN\u COUNT,999)作为SQL\u MAX\u COLUMN\u COUNT,来自WWV\u FLOW\u插件的SQL\u示例,其中FLOW\u ID=:B2和PLUGIN\u TYPE=:B1
2015年12月14日星期一14:31:14
线程1前进到日志序列233
当前日志#3 seq#233 mem#0:/u04/app/oracle/oradata/kcom/redo03.log
2015年12月14日星期一14:31:15
文件/u01/app/oracle/diag/rdbms/kcom/Rialto/trace/Rialto_arc0_3947.trc中存在错误:
ORA-19815:警告:268435456字节的db_recovery_file_dest_大小已被100.00%使用,剩余可用字节为0。
************************************************************************
您可以使用以下选项从闪存恢复区域释放空间:
1.考虑改变RMAN保留策略。如果您使用的是Data Guard,
然后考虑更改RMAN归档删除策略。
2.使用RMAN将文件备份到第三设备,如磁带
备份恢复区域命令。
3.添加磁盘空间并将db\u recovery\u file\u dest\u size参数增加到
反映新的空间。
4.使用RMAN Delete命令删除不必要的文件。如果一个运营商
系统命令用于删除文件,然后使用RMAN交叉检查和
删除过期的com
#/usr/bin/env python
import re
from datetime import datetime
# year, month, day, hour, minute
filter_from = datetime(2015, 12, 13, 23, 40)
with open("tmp.log") as log:
match = False
for line in log:
if (match):
print line
else:
candidate = re.match(r'[A-Z][a-z][a-z] [A-Z][a-z][a-z] \d\d \d\d:\d\d:\d\d \d\d\d\d', line)
if candidate:
parsed_date = datetime.strptime(candidate.group(0), "%a %b %d %X %Y")
if parsed_date > filter_from:
match = True
print line