最近我们发现在我们的 AlwaysOn 集群中,一个节点使用一个 NIC 作为两个 NIC 组的备用网卡。在另一个节点上,它正在积极使用两个 NIC。我们将第一个节点更改为活动节点,与其他节点相同。
我的问题是——我们是否需要重新启动 SQL 服务或服务器本身才能使这些更改从 SQL 角度(如 AG 同步)生效?
最近我们发现在我们的 AlwaysOn 集群中,一个节点使用一个 NIC 作为两个 NIC 组的备用网卡。在另一个节点上,它正在积极使用两个 NIC。我们将第一个节点更改为活动节点,与其他节点相同。
我的问题是——我们是否需要重新启动 SQL 服务或服务器本身才能使这些更改从 SQL 角度(如 AG 同步)生效?
在我的例子中,我想阻止来自具有 2 个模式的数据库的表和视图列表:
我想防止任何表和视图列表向特定用户公开,因此我查阅了这个答案:https ://dba.stackexchange.com/a/177272/118215
但是当我阅读答案时,我注意到 ROLE 与 USER 不同,并且登录是与上面的不同的“实体”。
尽管相关,但我无法理解以下两者之间的区别:
因此,有人可以解释差异吗?
我有一个 2 小时前的特定 spid,想知道谁在使用它。这可能吗?这是存储在缓存中,一些 DMV,Ringbuffer 中吗?SQL Server 2019。提前致谢。
我正在尝试为 SLES15 环境中的远程连接配置 Postgresql 14.7。我一直在遵循 Postgres 的Zypper 安装说明并补充了这些说明,因为我注意到两者之间的目录约定之间存在一些细微差别。看来我可以启动 postgresql 服务,但是在更新 conf 文件以接受远程连接后它失败了。
初始化 Postgresql 服务并sudo systemctl start postgresql
确保它处于活动状态后,我编辑了此处和此处postgres.conf
提到的和“pg_hba.conf”文件。
在postgresql.conf
我添加的文件中:
#listen_addresses = 'localhost'
listen_addresses = '*'
我补充说pg_hba.conf
:
# TYPE DATABASE USER ADDRESS METHOD
host all all 0.0.0.0/0 md5
host all all :/0 md5
然后我重新启动服务并sudo systemctl restart postgresql
收到以下错误:
PostgreSQL.service 的作业失败,因为控制进程退出并显示错误代码。
有关详细信息,请参阅“systemctl status postgresql.service”和“journalctl -xeu postgresql.service”`
的输出journalctl -xeu postgresql.service
给出:
journalctl -xeu postgresql.service
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A stop job for unit postgresql.service has begun execution.
░░
░░ The job identifier is 62101.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: postgresql.service: Deactivated successfully.
░░ Subject: Unit succeeded
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit postgresql.service has successfully entered the 'dead' state.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: Stopped PostgreSQL database server.
░░ Subject: A stop job for unit postgresql.service has finished
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A stop job for unit postgresql.service has finished.
░░
░░ The job identifier is 62101 and the job result is done.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: Starting PostgreSQL database server...
░░ Subject: A start job for unit postgresql.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit postgresql.service has begun execution.
░░
░░ The job identifier is 62101.
Apr 05 15:19:15 sph-gcmc2 postgresql-script[66239]: 2023-04-05 15:19:15.322 EDT [66239]LOG: redirecting log output to logging collector process
Apr 05 15:19:15 sph-gcmc2 postgresql-script[66239]: 2023-04-05 15:19:15.322 EDT [66239]HINT: Future log output will appear in directory "log".
Apr 05 15:19:15 sph-gcmc2 postgresql-script[66237]: pg_ctl: could not start server
Apr 05 15:19:15 sph-gcmc2 postgresql-script[66237]: Examine the log output.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit postgresql.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: postgresql.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit postgresql.service has entered the 'failed' state with result 'exit-code'.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: Failed to start PostgreSQL database server.
░░ Subject: A start job for unit postgresql.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit postgresql.service has finished with a failure.
░░
░░ The job identifier is 62101 and the job result is failed.
lines 387-440/440 (END)
在这一点上,我还没有尝试更新防火墙规则,这是工作流中的下一步,因为我的更改导致服务崩溃。
我的目标是使用 PostgreSQL 数据库作为 ESRI 企业地理数据库实例的主干,但数据库设置让我感到困惑。
在 Postgres 14 中添加带有锁定表的列NOT NULL DEFAULT X
并导致表重写吗?
如果它不锁定表并导致表重写(假设它只是元数据更改),那么我想后续的模式操作可能会触发数据重写。我怀疑以下操作可能会触发重写:
NOT NULL
如果我从新列中删除约束会怎样?这会导致X
写入所有行吗?X
?Y
我试图在数据库更改后插入每小时日志文件:
“待机/只读”模式
常规(在线)模式
“只读”模式
“还原”模式
“待机/只读”模式。
由于磁盘大小,我试图将 bak、mdf 和 ldf 文件从一个驱动器移动到另一个驱动器。
我试图将模式更改为“待机/只读”模式,因为目前,我们的每小时日志文件只有在处于“待机/只读”模式时才能插入到数据库中。
此日志文件来自第三方供应商。
当我尝试插入下一个每小时的日志文件时,我收到以下错误消息:
Msg 4330, Level 16, State 1, Line 3
This backup set cannot be applied because it is on a recovery path that
is inconsistent with the database.
The recovery path is the sequence of data and log backups that have
brought the database to a particular recovery point.
Find a compatible backup to restore, or restore the rest of the database
to match a recovery point within this backup set, which will restore the
database to a different point in time.
For more information about recovery paths, see SQL Server Books Online.
Msg 3013, Level 16, State 1, Line 3
RESTORE LOG is terminating abnormally.
Msg 4305, Level 16, State 1, Line 3
The log in this backup set begins at LSN 385165000000462400001, which is
too recent to apply to the database. An earlier log backup that includes
LSN 385162000002744000001 can be restored.
当我查看备份文件详细信息时,最后一个 LSN 显示385162000002744000001(橙色框中),因此从逻辑上讲,它应该插入下一个每小时的日志文件。
我的问题是,如果我那样改变模式(比如改变了 4 次),它会中断 LSN 的过程吗?
“不一致”是什么意思?
我正在查询 SQL Server 扩展事件元数据,我注意到有两组来源:sys.server_event_*
和sys.dm_xe_*
。这两个来源有什么区别?我应该在查询中使用哪一个?为什么?任何人都可以向我解释一下或提供一些资源以供进一步阅读吗?
我有一个在 Linux 上的 Docker 容器中运行的 SQL Server 2022 实例。我的理解是 Docker 容器可以简单地扩展它们的磁盘使用量以填满整个可用的卷空间。卷上的空间约为 10GB:
$ sudo df -h /var/lib/docker/
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 47G 34G 10G 78% /
然而,当我进入 SSMS 并查看数据库属性时,它显示“数据库大小 80.00 MB,可用空间 1.78MB”。为什么它说只有 1.78MB 可用?我的数据库是否仍能使用分区上的所有 10GB 空间?
我有一个现有的 MariaDB 表,我想保留使用内置系统版本控制功能的更改历史记录。我使用的是 MariaDB 10.5,但我还在 10.11(该系统将在接下来的 6-12 个月内迁移到该版本)上测试了这个问题中的所有内容。
我也想单独存储历史,原因如下:
但是,如果我尝试使用以下查询在现有表上执行此操作:
ALTER TABLE t ADD SYSTEM VERSIONING PARTITION BY SYSTEM_TIME;
这失败了:
SQL Error [1217] [23000]: (conn=5) Cannot delete or update a parent row: a foreign key constraint fails
即使我在运行查询之前关闭外键检查 (SET FOREIGN_KEY_CHECKS=0),也会发生这种情况。
我找到的解释是在MariaDB 文档的外键页面上:
分区表不能包含外键,也不能被外键引用。
这是否意味着如果表包含外键或被外键引用,则不可能通过单独保存历史记录进行系统版本控制?这似乎是我调查的结果,但考虑到大多数关系数据库都包含外键,而且 MariaDB 文档有一整节关于将历史记录保存在单独的分区中,这似乎也很奇怪——大概是因为这是一个常见的用例。
在 MariaDB 中有什么办法解决这个问题,还是我必须保留当前数据的历史记录(这将使数据集增加 10 倍)?另一种选择是创建一个单独的 t_history 表并让应用程序跟踪历史记录,但这不会捕获在应用程序外部所做的更改,例如,如果开发人员手动运行 UPDATE 查询。
SQL Server 跟踪各种内部位图中的页面分配。其中包括全局分配图 (GAM) 和页面可用空间 (PFS) 页。我们知道 GAM 页面以511232 页的设定间隔出现,PFS 页面以 8088 页的设定间隔出现。
给定一个足够大的数据文件,这种重复最终将导致一页成为 GAM 和 PFS 的下一行。计算一下,这发生在页码 516,855,552 处的 1,011 个 GAM 或 63,904 个 PFS 页之后。这相当于一个不到 4TB 的操作系统文件。由于单个数据文件的最大大小为 16TB(来源),这是允许的。
我的问题:当单个数据文件达到 4TB 时,哪种页面类型是页面 516855552 - GAM 还是 PFS?另一个去哪儿了?Paul Randal 的这条评论表明它被分流到 GAM 范围内其他未使用的页面之一:
除了第一个之外的 GAM extents 有 GAM, SGAM, DIFF_MAP, ML_MAP。每 4TB GAM extent 也将有一个 PFS 页面。
我发现这里引用了这个但没有明确解释:
-- There may be an issue with the ML map page position -- on the four extents where PFS pages and GAM pages live -- (at page IDs 516855552, 1033711104, 1550566656, 2067422208) -- but I think we'll be ok.
在谷歌上没有其他有意义的结果显示给我。
我有权访问的数据库有多个文件,因此没有一个符合大小要求。