AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题

问题[logs](dba)

Martin Hope
Olga Pshenichnikova
Asked: 2022-10-22 06:20:17 +0800 CST

数据库在重新启动后更改 MOUNT 模式

  • 5

我们一直在Oracle XE 10.2.0.1.0运行CentOS 6.9。

数据库一直稳定工作,除了系统重新启动。如果reboot在 OS 终端中发出命令,则数据库进入MOUNT模式。然后我们发出service oracle-xe restart TWICE来引入DBtoOPEN模式。第一次命令发出很快,最后第二次需要一些时间才能重新启动。正如我在日志中看到的,由于某些资源阻塞,第一次实例无法启动。它发出一个终止信号,然后在第二个service oracle-xe restart命令发出后开始。

我带来alert_XE.log 这里

所以这里是事件和时间:

  1. 2022 年 10 月 21 日星期五 12:11:46 - 重启后第一个 DB 启动,DB 进入 MOUNT 模式
  2. 2022 年 10 月 21 日星期五 12:26:50 - 第一service oracle-xe restart期
  3. Fri Oct 21 16:51:12 2022 - 第二service oracle-xe restart期,DB 进入 OPEN 模式

如果没有足够的信息为我提供解决方案的路径,您能否写信告诉我我需要提高哪些日志级别以及需要增加哪些日志,或者我需要查看哪些日志以查找丢失的信息。

更新

LD_LIBRARY_PATH我通过直接编辑修复了错误/etc/init.d/oracle-xe,并在环境变量定义块之后附加了以下行:

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LD_LIBRARY_PATH

现在,如果我按照Miracle173 的建议尝试OPEN数据库,则会出现以下错误:

ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory

更新

现在我们有新的错误alter.log,这就是接下来发生的事情ALTER DATABASE MOUNT:

Mon Oct 24 17:02:49 2022
Beginning crash recovery of 1 threads
Mon Oct 24 17:02:49 2022
Started redo scan
Mon Oct 24 17:02:49 2022
Completed redo scan
 147 redo blocks read, 78 data blocks need recovery
Mon Oct 24 17:02:49 2022
Started redo application at
 Thread 1: logseq 1791, block 3
Mon Oct 24 17:02:49 2022
Recovery of Online Redo Log: Thread 1 Group 2 Seq 1791 Reading mem 0
  Mem# 0 errs 0: /usr/lib/oracle/xe/app/oracle/flash_recovery_area/XE/onlinelog/o1_mf_2_dgsl2gd0_.log
Mon Oct 24 17:02:49 2022
Completed redo application
Mon Oct 24 17:02:49 2022
Completed crash recovery at
 Thread 1: logseq 1791, block 150, scn 284886106315
 78 data blocks read, 78 data blocks written, 147 redo blocks read
Mon Oct 24 17:02:49 2022
Thread 1 advanced to log sequence 1792
Thread 1 opened at log sequence 1792
  Current log# 1 seq# 1792 mem# 0: /usr/lib/oracle/xe/app/oracle/flash_recovery_area/XE/onlinelog/o1_mf_1_dgsl2dvq_.log
Successful open of redo thread 1
Mon Oct 24 17:02:49 2022
SMON: enabling cache recovery
Mon Oct 24 17:02:50 2022
Successfully onlined Undo Tablespace 1.
Mon Oct 24 17:02:50 2022
SMON: enabling tx recovery
Mon Oct 24 17:02:50 2022
Database Characterset is CL8MSWIN1251
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Process QMNC died, see its trace file
Mon Oct 24 17:02:51 2022
Errors in file /usr/lib/oracle/xe/app/oracle/admin/XE/udump/xe_ora_2423.trc:
ORA-00443: background process "QMNC" did not start
Mon Oct 24 17:02:51 2022
Errors in file /usr/lib/oracle/xe/app/oracle/admin/XE/udump/xe_ora_2423.trc:
ORA-00450: background process 'QMNC' did not start
ORA-00443: background process "QMNC" did not start
Error 450 happened during db open, shutting down database
USER: terminating instance due to error 450
Instance terminated by USER, pid = 2423
ORA-1092 signalled during: ALTER DATABASE OPEN...

这是尾巴/usr/lib/oracle/xe/app/oracle/admin/XE/udump/xe_ora_2423.trc:

*** 2022-10-24 17:02:49.712
KCRA: start recovery claims for 78 data blocks
*** 2022-10-24 17:02:49.721
KCRA: blocks processed = 78/78, claimed = 78, eliminated = 0
*** 2022-10-24 17:02:49.721
Recovery of Online Redo Log: Thread 1 Group 2 Seq 1791 Reading mem 0
----- Recovery Hash Table Statistics ---------
Hash table buckets = 32768
Longest hash chain = 1
Average hash chain = 78/78 = 1.0
Max compares per lookup = 1
Avg compares per lookup = 377/377 = 1.0
----------------------------------------------
*** 2022-10-24 17:02:51.204
Process QMNC is dead (pid=2545, state=3):
*** 2022-10-24 17:02:51.204
KSTDUMP: In-memory trace dump
TIME:SEQ#        ORAPID   SID EVENT  OP DATA
========================================================================
8DBD1DEB:0000066E    18    38 10254  34 KSBS1P: process USER trying to start background QMNC
8DBD1DEF:0000066F    18    38 10254  37 KSBS1P: process USER obtained PR enqueue to start background QMNC
8DCC0868:0000067C    18    38 10254  51 KSBS1P: out of loop: process did not start
KSTDUMP: End of in-memory trace dump
*** 2022-10-24 17:02:51.204
ORA-00443: background process "QMNC" did not start
ORA-00450: background process 'QMNC' did not start
ORA-00443: background process "QMNC" did not start

更新

好的,我成功连接到使用帐户会话MOUNT的 ed 实例,我尝试了:DBoracleALTER DATABASE OPEN

[root@MOBILE_TEST bdump]# su - oracle
-bash-4.1$ pwd
/usr/lib/oracle/xe
-bash-4.1$ groups
dba
-bash-4.1$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Oct 24 17:45:10 2022

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01034: ORACLE not available


SQL>

更新

我把登录oracle-xe:

start() {
        MAXI_LOG="/root/temp/ora.log"
        echo $(date) >> $MAXI_LOG

        if [ "$CONFIGURE_RUN" != "true" ]
        then
        echo "Oracle Database 10g Express Edition is not configured.  You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database."
                exit 0
        fi

        status=`ps -ef | grep tns | grep oracle`
        if [ "$status" == "" ]
        then
                echo "TNSLSTENER" >> $MAXI_LOG
                if [ -f $ORACLE_HOME/bin/tnslsnr ]
                then
                        echo "Starting Oracle Net Listener."
                        $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR  start" > /dev/null 2>&1
                fi
        fi

        echo "Starting Oracle Database 10g Express Edition Instance."
        echo "START" >> $MAXI_LOG
        $SU -s /bin/bash  $ORACLE_OWNER -c "$SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/startdb.sql" >> $MAXI_LOG 2>&1
        RETVAL=$?

        if [ $RETVAL -eq 0 ]
        then
                echo "GOOD" >> $MAXI_LOG
                echo
        else
                echo Failed to start Oracle Net Listener using $ORACLE_HOME/bin/tnslsnr\
                        and Oracle Express Database using $ORACLE_HOME/bin/sqlplus.
                echo "BAD" >> $MAXI_LOG
                RETVAL=1
        fi

        return $RETVAL
}

我重新启动了几次系统,这是我们在 $MAXI_LOG 中的内容:

25.10.2022 17:31:32 MSK 2022
TNSLSTENER
START
ORACLE instance started.

Total System Global Area  532676608 bytes
Fixed Size                  1259880 bytes
Variable Size             150996632 bytes
Database Buffers          377487360 bytes
Redo Buffers                2932736 bytes
Database mounted.
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory
GOOD
25.10.2022 17:33:25 MSK 2022
TNSLSTENER
START
ORACLE instance started.

Total System Global Area  532676608 bytes
Fixed Size                  1259880 bytes
Variable Size             150996632 bytes
Database Buffers          377487360 bytes
Redo Buffers                2932736 bytes
Database mounted.
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory
GOOD

我ls -t --full-time . | head -10用于查看最后的痕迹,这就是我所拥有的:

[root@MOBILE_TEST ~]# cd /usr/lib/oracle/xe/app/oracle/admin/XE/bdump/
[root@MOBILE_TEST bdump]# ls -t --full-time . | head -10
итого 16780
-rw-r--r--. 1 oracle dba 1906729 2022-10-25 17:33:34.694999956 +0300 alert_XE.log
-rw-r-----  1 oracle dba   39525 2022-10-25 17:02:32.848999960 +0300 xe_lgwr_2361.trc
[root@MOBILE_TEST udump]# ls -t --full-time . | head -10
итого 8976
-rw-r-----  1 oracle dba    3385 2022-10-25 17:33:30.663999958 +0300 xe_ora_2376.trc
-rw-r-----  1 oracle dba    8643 2022-10-25 17:33:27.485999961 +0300 xe_ora_2343.trc
-rw-r-----  1 oracle dba    5126 2022-10-25 17:31:37.601999962 +0300 xe_ora_2385.trc

这是尾巴xe_ora_2385.trc:

*** SERVICE NAME:() 2022-10-25 16:34:08.669
*** SESSION ID:(38.1) 2022-10-25 16:34:08.669
kccsga_update_ckpt: num_1 = 8, num_2 = 0, num_3 = 0, lbn_2 = 0, lbn_3 = 0
/usr/lib/oracle/xe/app/oracle/admin/XE/udump/xe_ora_2376.trc
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
ORACLE_HOME = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server
System name:    Linux
Node name:      MOBILE_TEST.domain.central
Release:        2.6.32-696.1.1.el6.i686
Version:        #1 SMP Tue Apr 11 16:37:48 UTC 2017
Machine:        i686
Instance name: XE
Redo thread mounted by this instance: 0 <none>
Oracle process number: 18
Unix process pid: 2376, image: oracle@MOBILE_TEST.domain.central (TNS V1-V3)

*** SERVICE NAME:() 2022-10-25 17:33:30.664
*** SESSION ID:(38.1) 2022-10-25 17:33:30.664
kccsga_update_ckpt: num_1 = 8, num_2 = 0, num_3 = 0, lbn_2 = 0, lbn_3 = 0

更新

我设置/etc/security/limits.conf:

*          hard    nproc     32768
*          hard    nofile    32768

登录ulimit脚本init:

$SU -s /bin/bash $ORACLE_OWNER -c "ulimit -a | grep '\-[nu]'" >> $ORA_LOG 2>&1

并且看到,限制没有问题:

Wed Oct 26 17:04:28 MSK 2022
open files                      (-n) 32768
max user processes              (-u) 32768

我也放Y了/etc/oratab。

但是问题依然存在...

logs
  • 1 个回答
  • 68 Views
Martin Hope
jimmiing
Asked: 2022-01-01 02:00:39 +0800 CST

我们是否需要额外的许可证才能将 Goldengate Trail 日志转储到 kafka?

  • 0

我们只有 Oracle (12c) GoldenGate 许可证(我们没有用于大数据的 Oracle Goldengate)。

我们需要将 gg trail 日志传输到 kafka,然后再传输到 hdfs。

我们是否需要购买 oracle 金门大数据许可证才能使用 kafka connect?

我们做过的研究:

这些是我们发现的以下 kafka 连接:

  1. 用于大数据的 kafka 连接:可能需要额外的许可证 https://docs.oracle.com/en/middleware/goldengate/big-data/19.1/gadbd/using-kafka-handler.html#GUID-2561CA12-9BAC-454B- A2E3-2D36C5C60EE5
  2. Kafka Connect 处理程序:我们从哪里得到它?我们需要哪些许可证? https://docs.oracle.com/en/middleware/goldengate/big-data/19.1/gadbd/using-kafka-connect-handler.html

其他链接: https ://stackoverflow.com/questions/56107652/how-can-i-configure-the-kafka-connect-handler-in-ogg-for-hdfs

oracle logs
  • 1 个回答
  • 150 Views
Martin Hope
SHR
Asked: 2021-01-18 02:39:15 +0800 CST

调用 DBMS_LOGMNR.START_LOGMNR 时出现“用户不存在”

  • 0

我有一个名为“MYADMIN”的 CDB 用户,我正在尝试让它连接到日志挖掘器。

-- enable calling admin username on CDB 
ALTER SESSION set "_ORACLE_SCRIPT"=true
/
-- create unique table space for admin
CREATE TABLESPACE myadmints DATAFILE '/path/to/admints.dbf' SIZE 20M AUTOEXTEND ON
/
-- create admin user on CDB
CREATE USER myadmin IDENTIFIED BY P@ssw0rd DEFAULT TABLESPACE myadmints QUOTA UNLIMITED ON myadmints ACCOUNT UNLOCK
/
-- allow access to all PDBs to the admin user
ALTER USER myadmin SET CONTAINER_DATA=ALL CONTAINER=CURRENT
/ 
-- grant needed permissions
GRANT DBA to myadmin 
GRANT CREATE SESSION TO myadmin 
GRANT CREATE TABLE TO myadmin 
GRANT EXECUTE_CATALOG_ROLE TO myadmin 
GRANT EXECUTE ON DBMS_LOGMNR TO myadmin 
GRANT SELECT ON V_$DATABASE TO myadmin 
GRANT SELECT ON V_$LOGMNR_CONTENTS TO myadmin 
GRANT SELECT ON V_$ARCHIVED_LOG TO myadmin 
GRANT SELECT ON V_$LOG TO myadmin 
GRANT SELECT ON V_$LOGFILE TO myadmin 
GRANT RESOURCE, CONNECT TO myadmin 

我从“v$archived_log”中选择了一行并尝试加载文件。

BEGIN
  DBMS_LOGMNR.ADD_LOGFILE(LogFileName=>'/path/to/archive/ARC000011_1061542581',Options=>DBMS_LOGMNR.new);
  DBMS_LOGMNR.START_LOGMNR(StartScn=>3083464, EndScn=>3388245, Options=>DBMS_LOGMNR.DICT_FROM_ONLINECATALOG+DBMS_LOGMNR.NO_ROW_ID_IN_STMT);
END;

我可以从sys as sysdba用户运行它,但是当我从“myadmin”用户运行它时,我得到:

Error report - 
ORA-01435: user does not exist
ORA-06512: at "SYS.DBMS_LOGMNR", line 72
ORA-06512: at line 3
01435. 00000 - "user does not exist"
*Cause:
*Action:

当我删除它时,错误是关于该START_LOGMNR行的,没有错误。

我缺少哪个特权?

oracle logs
  • 2 个回答
  • 441 Views
Martin Hope
Mike Blyth
Asked: 2020-06-09 10:41:45 +0800 CST

非确定性函数和基于行的二进制日志记录 (MySQL)

  • 1

新手提问。我正在开发一个仅使用行级二进制日志记录的 MySQL 项目。不会有复制。由于日志记录是行级的,因此函数是否具有确定性是否重要?从手册中,我的理解是它没有。

20 年 6 月 9 日添加:

我添加了一个我认为不确定的示例;如果我错了,请告诉我。对于给定的数据状态,结果将始终相同,返回一组行中的最高日期值,但对于给定患者 ID 的相同输入,并不总是返回相同的值,因为它会随着时间而变化。那正确吗?

CREATE FUNCTION `last_enc_date`(patient INT) RETURNS date
BEGIN
# Returns the date of the most recent encounter (of any kind) for patient
DECLARE lastvisit DATE;
SELECT MAX(DATE)
    INTO lastvisit 
    FROM encounters 
    WHERE personid = patient;
RETURN lastvisit;
END
mysql logs
  • 2 个回答
  • 209 Views
Martin Hope
bharat
Asked: 2019-12-11 01:01:21 +0800 CST

提高通知,提高信息未保存到 POSTGRES 中的日志

  • 4

我在谷歌上搜索了很多,但没有找到解决方案,我不确定我在这里缺少什么。

我的目的是将这个过程中的通知、信息存储到存储在日志目录中的 postgres 日志(txt 文件)中。

在 postgres 中,我写了一个简单的程序,如下所示。 - - 程序 - - -

create or replace procedure log_debug_info()
language 'plpgsql'
as $body$
begin
raise notice 'Test notice';
raise info 'Test info';
raise log 'test log';
raise debug 'test debug';
end;
$body$

----结束-------- 这是我在日志上的配置。

#------------------------------------------------------------------------------
# REPORTING AND LOGGING
#------------------------------------------------------------------------------

# - Where to Log -

log_destination = 'stderr'      # Valid values are combinations of
                    # stderr, csvlog, syslog, and eventlog,
                    # depending on platform.  csvlog
                    # requires logging_collector to be on.

# This is used when logging to stderr:
logging_collector = on      # Enable capturing of stderr and csvlog
                    # into log files. Required to be on for
                    # csvlogs.
                    # (change requires restart)

# These are only used if logging_collector is on:
#log_directory = 'log'          # directory where log files are written,
                    # can be absolute or relative to PGDATA
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'    # log file name pattern,
                    # can include strftime() escapes
log_file_mode = 0640            # creation mode for log files,
                    # begin with 0 to use octal notation
#log_truncate_on_rotation = off     # If on, an existing log file with the
                    # same name as the new log file will be
                    # truncated rather than appended to.
                    # But such truncation only occurs on
                    # time-driven rotation, not on restarts
                    # or size-driven rotation.  Default is
                    # off, meaning append to existing files
                    # in all cases.
#log_rotation_age = 1d          # Automatic rotation of logfiles will
                    # happen after that time.  0 disables.
#log_rotation_size = 10MB       # Automatic rotation of logfiles will
                    # happen after that much log output.
                    # 0 disables.

# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'
#syslog_sequence_numbers = on
#syslog_split_messages = on

# This is only relevant when logging to eventlog (win32):
# (change requires restart)
#event_source = 'PostgreSQL'

# - When to Log -

#log_min_messages = debug5      # values in order of decreasing detail:
                    #   debug5
                    #   debug4
                    #   debug3
                    #   debug2
                    #   debug1
                    #   info
                    #   notice
                    #   warning
                    #   error
                    #   log
                    #   fatal
                    #   panic

#log_min_error_statement = debug1   # values in order of decreasing detail:
                    #   debug5
                    #   debug4
                    #   debug3
                    #   debug2
                    #   debug1
                    #   info
                    #   notice
                    #   warning
                    #   error
                    #   log
                    #   fatal
                    #   panic (effectively off)

#log_min_duration_statement = 1 # -1 is disabled, 0 logs all statements
                    # and their durations, > 0 logs only
                    # statements running at least this number
                    # of milliseconds


# - What to Log -

#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
#debug_pretty_print = on
#log_checkpoints = off
#log_connections = off
#log_disconnections = off
#log_duration = off
#log_error_verbosity = default      # terse, default, or verbose messages
#log_hostname = off
#log_line_prefix = '%m [%p] '       # special values:
                    #   %a = application name
                    #   %u = user name
                    #   %d = database name
                    #   %r = remote host and port
                    #   %h = remote host
                    #   %p = process ID
                    #   %t = timestamp without milliseconds
                    #   %m = timestamp with milliseconds
                    #   %n = timestamp with milliseconds (as a Unix epoch)
                    #   %i = command tag
                    #   %e = SQL state
                    #   %c = session ID
                    #   %l = session line number
                    #   %s = session start timestamp
                    #   %v = virtual transaction ID
                    #   %x = transaction ID (0 if none)
                    #   %q = stop here in non-session
                    #        processes
                    #   %% = '%'
                    # e.g. '<%u%%%d> '
#log_lock_waits = off           # log lock waits >= deadlock_timeout
#log_statement = 'all'          # none, ddl, mod, all
#log_replication_commands = off
#log_temp_files = -1            # log temporary files equal or larger
                    # than the specified size in kilobytes;
                    # -1 disables, 0 logs all temp files

----------------日志文件-----------这是正在生成的日志文件,但我在那里看不到通知和信息,我只看到提升日志部分。

2019-12-10 14:18:23.222 IST [5392] LOG:  test log
2019-12-10 14:18:23.222 IST [5392] CONTEXT:  PL/pgSQL function log_debug_info() line 5 at RAISE
2019-12-10 14:18:23.222 IST [5392] STATEMENT:  CALL public.log_debug_info()

请帮忙,我在这里缺少什么?

postgresql logs
  • 1 个回答
  • 4447 Views
Martin Hope
Marcello Miorelli
Asked: 2019-09-28 08:19:09 +0800 CST

如何找出最后一次 DBCC checkdb 完成了多长时间?

  • 1

在我的大多数服务器中,我都计划运行dbcc checkdb 。

我可以通过DBCC DBINFO()获得最后一个已知的良好 DBCC Checkdb 。

我可以读取 sql server 日志中留下的痕迹,并且得到如下图所示的内容:

在此处输入图像描述

或者我可以运行以下脚本:

IF OBJECT_ID('TEMPDB..#MAINT') IS NOT NULL
   DROP TABLE #maint

CREATE TABLE #maint (Results varchar(255) NULL)
INSERT INTO #maint(Results) EXEC('master..xp_cmdshell ''sqlcmd -E -Q"dbcc checkdb([my_database])"''')

select * from #maint 

得到这样的东西: 在此处输入图像描述

我还可以查看默认跟踪。

我在追求什么?

如何找出上次运行 dbcc checkdb 花了多长时间。

sql-server logs
  • 2 个回答
  • 680 Views
Martin Hope
Maryna Krasnova
Asked: 2018-08-22 02:18:59 +0800 CST

Postgres logging_collector 可能会阻止 auto_explain 输出

  • 1

Postgres 10.4

Postgres 9.6

两个版本都有问题

我想收集 postgresql 慢查询计划,所以我从文档中添加到我的 postgresql.conf 设置

session_preload_libraries = 'auto_explain'

auto_explain.log_min_duration = '5s'

在配置的最后

但我们也使用

logging_collector = true

如果 logging_collector 开启,则日志中没有解释

如果 logging_collector 发表评论,我可以看到查询计划 我如何使用这两个选项?

更新: 我们有大约 10 个查询运行超过 5 秒,但最终使用 grep 我们发现日志中只有一个输出带有解释而不是所有计划怎么可能只记录了一条记录?neither all plans, no no plans only one explain 不是所有的计划

postgresql logs
  • 1 个回答
  • 118 Views
Martin Hope
Vinicius Deschamps
Asked: 2017-10-05 06:15:32 +0800 CST

logRotate 会导致 MongoDB 服务不可用吗?

  • 1

在另一个问题中,我提到了如何在安装在 Windows Server 中的 MongoDB 副本集中轮换日志。但是,似乎没有内置的方法可以在 Windows 上自动获取它——只能使用 3rd 方工具。

话虽如此,我想知道如果我连接到 MongoDB 并执行会发生什么

use admin
db.runCommand( { logRotate : 1 } )

会不会导致MongoDB服务不可用?或者只是停止日志捕获几秒钟并开始写入新文件的问题?

mongodb logs
  • 1 个回答
  • 85 Views
Martin Hope
Sahap Asci
Asked: 2017-09-30 13:29:12 +0800 CST

使用 sql 获取 postgresql 确切的日志文件名

  • 0

我通过使用 SQL 获取当前日志文件,而无需通过 ssh 进入服务器。所以我使用如下所示的查询;

SELECT pg_read_binary_file(
  concat_ws('/', 
    current_setting('log_directory'),
    'postgresql-Fri.log'
  )
);

日志文件不是太大,所以我没问题。问题是,我不能以通用方式使用此查询。有没有办法从我log_filename当前的设置中获取“postgresql-Fri.log”,postgresql-%a.log但格式可能不同?

postgresql logs
  • 1 个回答
  • 1374 Views
Martin Hope
Leonardo
Asked: 2017-04-07 05:15:44 +0800 CST

SQL Server:日志文件夹太大

  • 4

请注意,我不是在谈论事务日志。我指的是 SQL Server 中一个名为“Log”的文件夹,其中存在 ErrorLog 和 SQLDrmp 文件。

好吧,事实是,在总存储为 250GB 的机器开发机器上,这个文件夹每天增长 8GB。那是个问题。

我发现我可以创建一个名为 Log2 的新文件夹,运行sp_cycle_errorlog将新的“错误日志”副本复制到这个新文件夹,停止 SQL Server(和代理)切换文件夹,再次启动 SQL Server(和代理),然后删除旧的文件夹。

理想情况下,我想禁用这种日志记录,但如果不可能,有没有办法自动清理它?我的意思是,也许丢弃日志?

sql-server logs
  • 2 个回答
  • 10736 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve