windows 7 vs 2013编译与安装MySQL 5.7

操作环境准备
1.在Win7上安装好Visual Studio 2013
2.下载MySQL 5.7.25源代码
3.安装CMake https://cmake.org/ 安装的时候,选择在PATH中加入
4.安装Bison: http://gnuwin32.sourceforge.net/packages/bison.htm 安装路径不要有空格
5.安装perl tool:ActivePerl-5.16.3.1604-MSWin32-x64-298023.msi

为了验证成功,可以执行以下命令:

C:\Users\Administrator>where bison
C:\GnuWin32\bin\bison.exe

C:\Users\Administrator>where cmake
C:\CMake\bin\cmake.exe

C:\Users\Administrator>where perl
C:\Perl64\bin\perl.exe

如果出现找不到,那就自己加path就行了

编译操作如下:
1. MySQL5.7.25的源文件存放在D:\Code_workspace\mysql-5.7.25目录下

D:\Code_workspace\mysql-5.7.25>dir
 驱动器 D 中的卷是 软件
 卷的序列号是 5D84-49C8

 D:\Code_workspace\mysql-5.7.25 的目录

2018-12-21  11:52              .
2018-12-21  11:52              ..
2018-12-21  11:52              BUILD
2018-12-21  11:52              client
2018-12-21  11:52              cmake
2018-12-21  11:39            27,753 CMakeLists.txt
2018-12-21  11:52              cmd-line-utils
2018-12-21  11:39            13,900 config.h.cmake
2018-12-21  11:39            25,850 configure.cmake
2018-12-21  11:39            17,987 COPYING
2018-12-21  11:52              dbug
2018-12-21  11:52              Docs
2018-12-21  11:39            66,241 Doxyfile-perfschema
2018-12-21  11:52              extra
2018-12-21  11:52              include
2018-12-21  11:39               333 INSTALL
2018-12-21  11:52              libbinlogevents
2018-12-21  11:52              libbinlogstandalone
2018-12-21  11:52              libevent
2018-12-21  11:52              libmysql
2018-12-21  11:52              libmysqld
2018-12-21  11:52              libservices
2018-12-21  11:52              man
2018-12-21  11:52              mysql-test
2018-12-21  11:52              mysys
2018-12-21  11:52              mysys_ssl
2018-12-21  11:52              packaging
2018-12-21  11:52              plugin
2018-12-21  11:52              rapid
2018-12-21  11:39             2,478 README
2018-12-21  11:52              regex
2018-12-21  11:52              scripts
2018-12-21  11:52              sql
2018-12-21  11:52              sql-common
2018-12-21  11:52              storage
2018-12-21  11:52              strings
2018-12-21  11:52              support-files
2018-12-21  11:52              testclients
2018-12-21  11:52              unittest
2018-12-21  11:39                88 VERSION
2018-12-21  11:52              vio
2018-12-21  11:52              win
2018-12-21  11:52              zlib
               8 个文件        154,630 字节
              35 个目录 18,364,108,800 可用字节

2.将boost文件存放在D:\Code_workspace\boost_1_59_0目录下

3.创建BLD文件夹并进入该文件夹。

D:\Code_workspace\mysql-5.7.25>mkdir BLD

D:\Code_workspace\mysql-5.7.25>cd BLD

D:\Code_workspace\mysql-5.7.25\BLD>

4.执行下面的命令,会下载boost文件夹,并在BLD文件夹下创建相关的项目文件:

D:\Code_workspace\mysql-5.7.25\BLD>cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST="D:\Code_workspace\boost_1_59_0"
-- Building for: Visual Studio 12 2013
CMake Deprecation Warning at CMakeLists.txt:28 (CMAKE_POLICY):
  The OLD behavior for policy CMP0018 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:34 (CMAKE_POLICY):
  The OLD behavior for policy CMP0022 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:41 (CMAKE_POLICY):
  The OLD behavior for policy CMP0045 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:42 (CMAKE_POLICY):
  The OLD behavior for policy CMP0042 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Running cmake version 3.15.0-rc1
-- Could NOT find Git (missing: GIT_EXECUTABLE)
-- Configuring with MAX_INDEXES = 64U
-- The C compiler identification is MSVC 18.0.21005.1
-- The CXX compiler identification is MSVC 18.0.21005.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_GENERATOR: Visual Studio 12 2013
-- Looking for sys/types.h
CMake Warning (dev) at C:/CMake/share/cmake-3.15/Modules/CheckIncludeFile.cmake:80 (message):
  Policy CMP0075 is not set: Include file check macros honor
  CMAKE_REQUIRED_LIBRARIES.  Run "cmake --help-policy CMP0075" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  CMAKE_REQUIRED_LIBRARIES is set to:

    ws2_32

  For compatibility with CMake 3.11 and below this check is ignoring it.
Call Stack (most recent call first):
  C:/CMake/share/cmake-3.15/Modules/CheckTypeSize.cmake:230 (check_include_file)
  CMakeLists.txt:190 (CHECK_TYPE_SIZE)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- SIZEOF_VOIDP 4
-- MySQL 5.7.25
-- Packaging as: mysql-5.7.25-win32
-- Local boost dir D:/Code_workspace/boost_1_59_0
-- Found D:/Code_workspace/boost_1_59_0/boost/version.hpp
-- BOOST_VERSION_NUMBER is #define BOOST_VERSION 105900
-- BOOST_INCLUDE_DIR D:/Code_workspace/boost_1_59_0
-- Found Threads: TRUE
-- Looking for include file crypt.h
-- Looking for include file crypt.h - not found
-- Looking for getnameinfo
-- Looking for getnameinfo - not found
-- Looking for inet_ntop
-- Looking for inet_ntop - not found
-- Looking for log2
-- Looking for log2 - found
-- Looking for isinf
-- Looking for isinf - found
-- Performing Test HAVE_CXX_ISINF
-- Performing Test HAVE_CXX_ISINF - Success
-- Check size of struct timespec
-- Check size of struct timespec - failed
-- Performing Test HAVE_VISIBILITY_HIDDEN
-- Performing Test HAVE_VISIBILITY_HIDDEN - Success
-- Check size of struct sockaddr_in6
-- Check size of struct sockaddr_in6 - done
-- Check size of struct in6_addr
-- Check size of struct in6_addr - done
-- Performing Test HAVE_IMPLICIT_DEPENDENT_NAME_TYPING
-- Performing Test HAVE_IMPLICIT_DEPENDENT_NAME_TYPING - Success
-- Looking for chown
-- Looking for chown - not found
-- Looking for include file numa.h
-- Looking for include file numa.h - not found
-- Looking for include file numaif.h
-- Looking for include file numaif.h - not found
-- NUMA library missing or required version not available
-- Check size of socklen_t
-- Check size of socklen_t - failed
-- Check size of off64_t
-- Check size of off64_t - failed
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Performing Test HAVE_STRINGOP_OVERFLOW
-- Performing Test HAVE_STRINGOP_OVERFLOW - Failed
-- Performing Test HAVE_NO_UNUSED_CONST_VAR
-- Performing Test HAVE_NO_UNUSED_CONST_VAR - Failed
-- Cannot find system sasl libraries.
-- WITH_PROTOBUF=bundled
-- Performing Test HAVE_NO_SIGN_COMPARE
-- Performing Test HAVE_NO_SIGN_COMPARE - Failed
-- Performing Test HAVE_NO_UNUSED_TYPEDEFS
-- Performing Test HAVE_NO_UNUSED_TYPEDEFS - Failed
-- Performing Test HAVE_NO_IGNORED_QUALIFIERS
-- Performing Test HAVE_NO_IGNORED_QUALIFIERS - Failed
-- Performing Test HAVE_NO_RETURN_TYPE
-- Performing Test HAVE_NO_RETURN_TYPE - Failed
-- Performing Test HAVE_NO_UNUSED_FUNCTION
-- Performing Test HAVE_NO_UNUSED_FUNCTION - Failed
-- Performing Test HAVE_MAYBE_UNINITIALIZED
-- Performing Test HAVE_MAYBE_UNINITIALIZED - Failed
-- Performing Test HAVE_UNUSED_BUT_SET
-- Performing Test HAVE_UNUSED_BUT_SET - Failed
-- protobuf version is 2.6
-- Performing Test HAVE_SYS_THREAD_SELFID
-- Performing Test HAVE_SYS_THREAD_SELFID - Failed
-- Performing Test HAVE_SYS_GETTID
-- Performing Test HAVE_SYS_GETTID - Failed
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP - Failed
-- Performing Test HAVE_INTEGER_PTHREAD_SELF
-- Performing Test HAVE_INTEGER_PTHREAD_SELF - Failed
-- Performing Test HAVE_STRINGOP_TRUNCATION
-- Performing Test HAVE_STRINGOP_TRUNCATION - Failed
-- Creating LDAP authentication SASL client library.
--  You need to set WITH_SASL path to build LDAP SASL client authentication plugin.
-- Library mysqlclient depends on OSLIBS ws2_32;Secur32
-- MERGE_CONVENIENCE_LIBRARIES TARGET mysqlclient
-- MERGE_CONVENIENCE_LIBRARIES LIBS clientlib;dbug;strings;vio;mysys;mysys_ssl;zlib;yassl;taocrypt;auth_win_client
-- MERGE_CONVENIENCE_LIBRARIES MYLIBS clientlib;dbug;strings;vio;mysys;mysys_ssl;zlib;yassl;taocrypt;auth_win_client
-- Looking for include file endian.h
-- Looking for include file endian.h - not found
-- Check size of long long
-- Check size of long long - done
-- Check size of long
-- Check size of long - done
-- Check size of int
-- Check size of int - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Performing Test HAVE_CAST_FUNCTION_TYPE
-- Performing Test HAVE_CAST_FUNCTION_TYPE - Failed
-- Using cmake version 3.15.0-rc1
-- Not building NDB
-- Performing Test HAVE_UNUSED_TYPEDEFS
-- Performing Test HAVE_UNUSED_TYPEDEFS - Failed
-- Performing Test HAVE_STRUCT_SOCKADDR_SA_LEN
-- Performing Test HAVE_STRUCT_SOCKADDR_SA_LEN - Failed
-- Performing Test HAVE_STRUCT_IFREQ_IFR_NAME
-- Performing Test HAVE_STRUCT_IFREQ_IFR_NAME - Failed
-- Performing Test HAVE_XDR_OPS_X_PUTINT32
-- Performing Test HAVE_XDR_OPS_X_PUTINT32 - Success
-- Performing Test HAVE_XDR_OPS_X_GETINT32
-- Performing Test HAVE_XDR_OPS_X_GETINT32 - Success
-- Performing Test HAVE___CONST
-- Performing Test HAVE___CONST - Success
-- Performing Test HAVE_RPC_INLINE_T
-- Performing Test HAVE_RPC_INLINE_T - Failed
-- Using Boost headers from D:/Code_workspace/boost_1_59_0
-- Performing Test CXX_HAVE_SIGN_COMPARE
-- Performing Test CXX_HAVE_SIGN_COMPARE - Failed
-- Performing Test CXX_HAVE_UNUSED_VARIABLE
-- Performing Test CXX_HAVE_UNUSED_VARIABLE - Failed
-- MYSQLX - Text log of protobuf messages enabled
-- Performing Test HAVE_UNUSED_PARAMETER
-- Performing Test HAVE_UNUSED_PARAMETER - Failed
-- Googletest was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source.
-- If you are inside a firewall, you may need to use an https proxy: export https_proxy=http://example.com:80
-- Performing Test HAVE_MISLEADING_INDENTATION
-- Performing Test HAVE_MISLEADING_INDENTATION - Failed
-- Performing Test HAVE_NO_BUILTIN_MEMCMP
-- Performing Test HAVE_NO_BUILTIN_MEMCMP - Success
-- executable target mysqld debug_target D:/Code_workspace/mysql-5.7.25/BLD/sql/Debug/mysqld.exe
-- Library mysqlserver depends on OSLIBS ws2_32
-- MERGE_CONVENIENCE_LIBRARIES TARGET mysqlserver
-- MERGE_CONVENIENCE_LIBRARIES LIBS dbug;strings;regex;mysys;mysys_ssl;vio;zlib;yassl;taocrypt;archive_embedded;blackhole_embedded;csv_embedded;federated_embedded;heap_embedded;inn
obase;lz4_lib;myisam_embedded;myisammrg_embedded;partition_embedded;ngram_parser;sql_embedded
-- MERGE_CONVENIENCE_LIBRARIES MYLIBS dbug;strings;regex;mysys;mysys_ssl;vio;zlib;yassl;taocrypt;archive_embedded;blackhole_embedded;csv_embedded;federated_embedded;heap_embedded;i
nnobase;lz4_lib;myisam_embedded;myisammrg_embedded;partition_embedded;ngram_parser;sql_embedded
-- WIX_DIR WIX_DIR-NOTFOUND path C:\Program Files/WiX Toolset V3.8
-- WIX_DIR WIX_DIR-NOTFOUND path C:\Program Files/WiX Toolset V3.8/bin
-- WIX_DIR WIX_DIR-NOTFOUND path C:\Program Files (x86)/WiX Toolset V3.8
-- WIX_DIR WIX_DIR-NOTFOUND path C:\Program Files (x86)/WiX Toolset V3.8/bin
-- WIX_DIR WIX_DIR-NOTFOUND looked at
-- Cannot find wix 3, installer project will not be generated
-- COMPILE_DEFINITIONS: _WIN32_WINNT=0x0601;WIN32_LEAN_AND_MEAN;NOGDI;NOMINMAX;BOOST_GEOMETRY_SQRT_CHECK_FINITENESS;HAVE_CONFIG_H;HAVE_LIBEVENT1
-- CMAKE_C_FLAGS: /DWIN32 /D_WINDOWS /W3 /MP /wd4800 /wd4805 /wd4996
-- CMAKE_CXX_FLAGS: /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MP /wd4800 /wd4805 /wd4996 /we4099
-- CMAKE_C_LINK_FLAGS:
-- CMAKE_CXX_LINK_FLAGS:
-- CMAKE_C_FLAGS_DEBUG: /MDd /Z7 /Ob1 /Od /RTC1 /EHsc -DENABLED_DEBUG_SYNC -DSAFE_MUTEX
-- CMAKE_CXX_FLAGS_DEBUG: /MDd /Z7 /Ob1 /Od /RTC1 /EHsc -DENABLED_DEBUG_SYNC -DSAFE_MUTEX
-- CMAKE_C_FLAGS_RELWITHDEBINFO: /MD /Z7 /O2 /Ob1 /DNDEBUG /EHsc -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: /MD /Z7 /O2 /Ob1 /DNDEBUG /EHsc -DDBUG_OFF
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Code_workspace/mysql-5.7.25/BLD

D:\Code_workspace\mysql-5.7.25\BLD>

如果是编译64位,需要加参数 cmake .. –G “Visual Studio 12 2013 Win64”

5.打开sql\sql_locale.cc文件,用UTF-8的格式,再保存一遍,否则编译会出错。

6.运行下面的命令开始编译源码

D:\Code_workspace\mysql-5.7.25\BLD>cmake --build . --config relwithdebinfo --target package
........
     正在创建库 D:/Code_workspace/mysql-5.7.25/BLD/sql/RelWithDebInfo/udf_example.lib 和对象 D:/Code_workspace/mysql-5.7.25/BLD/sql/RelWithDebInfo/udf_example.exp
  udf_example.vcxproj -> D:\Code_workspace\mysql-5.7.25\BLD\sql\RelWithDebInfo\udf_example.dll
  Building Custom Rule D:/Code_workspace/mysql-5.7.25/plugin/password_validation/CMakeLists.txt
  validate_password.cc
     正在创建库 D:/Code_workspace/mysql-5.7.25/BLD/plugin/password_validation/RelWithDebInfo/validate_password.lib 和对象 D:/Code_workspace/mysql-5.7.25/BLD/plugin/password_validat
ion/Rel
  WithDebInfo/validate_password.exp
  validate_password.vcxproj -> D:\Code_workspace\mysql-5.7.25\BLD\plugin\password_validation\RelWithDebInfo\validate_password.dll
  Building Custom Rule D:/Code_workspace/mysql-5.7.25/plugin/version_token/CMakeLists.txt
  version_token.cc
     正在创建库 D:/Code_workspace/mysql-5.7.25/BLD/plugin/version_token/RelWithDebInfo/version_token.lib 和对象 D:/Code_workspace/mysql-5.7.25/BLD/plugin/version_token/RelWithDebIn
fo/vers
  ion_token.exp
  version_token.vcxproj -> D:\Code_workspace\mysql-5.7.25\BLD\plugin\version_token\RelWithDebInfo\version_token.dll
  Building Custom Rule D:/Code_workspace/mysql-5.7.25/extra/CMakeLists.txt
  zlib_decompress.cc
  zlib_decompress.vcxproj -> D:\Code_workspace\mysql-5.7.25\BLD\extra\RelWithDebInfo\zlib_decompress.exe
  Building Custom Rule D:/Code_workspace/mysql-5.7.25/CMakeLists.txt
  CPack: Create package using ZIP
  CPack: Install projects
  CPack: - Install project: MySQL
  CPack: Create package
  CPack: - package: D:/Code_workspace/mysql-5.7.25/BLD/mysql-5.7.25-win32.zip generated.

在文件夹中,有MySQL文件夹和winzip包产生:

D:\Code_workspace\mysql-5.7.25\BLD\_CPack_Packages\win32\ZIP>dir
 驱动器 D 中的卷是 软件
 卷的序列号是 5D84-49C8

 D:\Code_workspace\mysql-5.7.25\BLD\_CPack_Packages\win32\ZIP 的目录

2019-06-13  23:26              .
2019-06-13  23:26              ..
2019-06-13  23:25              mysql-5.7.25-win32
2019-06-13  23:26       426,298,188 mysql-5.7.25-win32.zip
               1 个文件    426,298,188 字节
               3 个目录  6,277,496,832 可用字节

下面使用自己编译的安装包来进行安装
1.将生成的安装包mysql-5.7.25-win32.zip解压D:\mysql-5.7.25-win32目录中,

2.在D:\mysql-5.7.25-win32目录中创建一个data目录用来存放数据文件

3.在mysql-5.7.25-win32根目录下创建my.ini文件添加以下内容

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4

[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:\mysql-5.7.25-win32
# 设置 mysql数据库的数据的存放目录
datadir=D:\mysql-5.7.25-win32\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
explicit_defaults_for_timestamp=true
log-error=D:\mysql-5.7.25-win32\mysql.err
pid-file=D:\mysql-5.7.25-win32\mysqld.pid
socket =D:\mysql-5.7.25-win32\mysql.sock

4.文件目录切换至cmd所在路径(C:\Windows\System32\cmd.exe),右键以管理员身份运行cmd.exe,命令行进入mysql的bin目录,初始化数据库文件

C:\Users\Administrator>D:

D:\>cd D:\mysql-5.7.25-win32\bin

D:\mysql-5.7.25-win32\bin>mysqld --defaults-file=D:\mysql-5.7.25-win32\my.ini  -
-initialize

D:\mysql-5.7.25-win32\bin>

5.初始化成功后会在my.ini配置文件的datadir的目录下生成一些文件,其中mysql.err文件里说明了root账户的临时密码。例如:)CRHHke1mik=就是root账户的临时密码

2019-06-14T02:21:39.232301Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-06-14T02:21:39.335307Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-06-14T02:21:39.388310Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 2447abd5-8e4b-11e9-81b2-00505683446c.
2019-06-14T02:21:39.395311Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-06-14T02:21:39.442313Z 1 [Note] A temporary password is generated for root@localhost: )CRHHke1mik=

6.注册MySQL服务

D:\mysql-5.7.25-win32\bin>mysqld -install MySQL
Service successfully installed.

7.启动MySQL服务

C:\Users\Administrator>net start MySQL
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

8.使用root账号登录MySQL数据库

D:\mysql-5.7.25-win32\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.25

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement befo
re executing this statement.
mysql>

9.修改root用户密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)

10.使用修改后的密码进行登录

D:\mysql-5.7.25-win32\bin>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.25 Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

到此使用vs2013编译的MySQL源码在Win7上安装完成了。

在Oracle Linux 7.1上安装Docker

在Oracle Linux 7.1上安装Docker
1.首先使用正确的yum设置来升级Oracle Linux 7.1实例。为了安装最新的Docker版本(18.9.1.ce),需要ol7_latest,ol7_uekr4与ol7_addons启用

[root@localhost /]# cd /etc/yum.repos.d/
[root@localhost /]#wget http://yum.oracle.com/public-yum-ol7.repo
[root@localhost yum.repos.d]# vi public-yum-ol7.repo
[ol7_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_UEKR4]
name=Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_addons]
name=Oracle Linux $releasever Add ons ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

2.开始安装docker

[root@localhost yum.repos.d]# yum install docker-engine
Loaded plugins: langpacks
ol7_UEKR4                                                                                                                                                                                                            | 2.5 kB  00:00:00
ol7_addons                                                                                                                                                                                                           | 1.2 kB  00:00:00
ol7_latest                                                                                                                                                                                                           | 2.7 kB  00:00:00
(1/4): ol7_addons/x86_64/updateinfo                                                                                                                                                                                  |  60 kB  00:00:00
(2/4): ol7_UEKR4/x86_64/updateinfo                                                                                                                                                                                   |  82 kB  00:00:01
(3/4): ol7_addons/x86_64/primary                                                                                                                                                                                     |  82 kB  00:00:02
(4/4): ol7_UEKR4/x86_64/primary_db                                                                                                                                                                                   | 4.0 MB  00:03:38
ol7_addons                                                                                                                                                                                                                          328/328
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:18.09.1.ol-1.0.5.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.77 for package: docker-engine-18.09.1.ol-1.0.5.el7.x86_64
--> Processing Dependency: libseccomp >= 2.3 for package: docker-engine-18.09.1.ol-1.0.5.el7.x86_64
--> Processing Dependency: containerd for package: docker-engine-18.09.1.ol-1.0.5.el7.x86_64
--> Processing Dependency: docker-cli for package: docker-engine-18.09.1.ol-1.0.5.el7.x86_64
--> Processing Dependency: runc for package: docker-engine-18.09.1.ol-1.0.5.el7.x86_64
--> Processing Dependency: libdevmapper.so.1.02(DM_1_02_97)(64bit) for package: docker-engine-18.09.1.ol-1.0.5.el7.x86_64
--> Processing Dependency: libsystemd.so.0(LIBSYSTEMD_209)(64bit) for package: docker-engine-18.09.1.ol-1.0.5.el7.x86_64
--> Processing Dependency: libsystemd.so.0()(64bit) for package: docker-engine-18.09.1.ol-1.0.5.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.77-5.el7 will be installed
--> Processing Dependency: selinux-policy-base >= 3.13.1-216.el7 for package: 2:container-selinux-2.77-5.el7.noarch
--> Processing Dependency: selinux-policy >= 3.13.1-216.el7 for package: 2:container-selinux-2.77-5.el7.noarch
--> Processing Dependency: policycoreutils >= 2.5-11 for package: 2:container-selinux-2.77-5.el7.noarch
--> Processing Dependency: selinux-policy-targeted >= 3.13.1-216.el7 for package: 2:container-selinux-2.77-5.el7.noarch
---> Package containerd.x86_64 0:1.2.0-1.0.5.el7 will be installed
---> Package device-mapper-libs.x86_64 7:1.02.93-3.el7 will be updated
--> Processing Dependency: device-mapper-libs = 7:1.02.93-3.el7 for package: 7:device-mapper-1.02.93-3.el7.x86_64
---> Package device-mapper-libs.x86_64 7:1.02.149-10.0.3.el7_6.8 will be an update
---> Package docker-cli.x86_64 0:18.09.1.ol-1.0.5.el7 will be installed
---> Package libseccomp.x86_64 0:2.1.1-2.el7 will be updated
---> Package libseccomp.x86_64 0:2.3.1-3.el7 will be an update
---> Package runc.x86_64 0:1.0.0-19.rc5.git4bb1fe4.0.3.el7 will be installed
--> Processing Dependency: criu for package: runc-1.0.0-19.rc5.git4bb1fe4.0.3.el7.x86_64
---> Package systemd-libs.x86_64 0:208-20.0.1.el7 will be updated
--> Processing Dependency: systemd-libs = 208-20.0.1.el7 for package: systemd-208-20.0.1.el7.x86_64
---> Package systemd-libs.x86_64 0:219-62.0.4.el7_6.7 will be an update
--> Processing Dependency: liblz4.so.1()(64bit) for package: systemd-libs-219-62.0.4.el7_6.7.x86_64
--> Running transaction check
---> Package criu.x86_64 0:3.9-5.el7 will be installed
--> Processing Dependency: libprotobuf-c.so.1(LIBPROTOBUF_C_1.0.0)(64bit) for package: criu-3.9-5.el7.x86_64
--> Processing Dependency: libnl-3.so.200(libnl_3)(64bit) for package: criu-3.9-5.el7.x86_64
--> Processing Dependency: libprotobuf-c.so.1()(64bit) for package: criu-3.9-5.el7.x86_64
--> Processing Dependency: libnet.so.1()(64bit) for package: criu-3.9-5.el7.x86_64
---> Package device-mapper.x86_64 7:1.02.93-3.el7 will be updated
--> Processing Dependency: device-mapper = 7:1.02.93-3.el7 for package: 7:device-mapper-event-1.02.93-3.el7.x86_64
---> Package device-mapper.x86_64 7:1.02.149-10.0.3.el7_6.8 will be an update
---> Package lz4.x86_64 0:1.7.5-2.0.1.el7 will be installed
---> Package policycoreutils.x86_64 0:2.2.5-15.0.1.el7 will be updated
--> Processing Dependency: policycoreutils = 2.2.5-15.0.1.el7 for package: policycoreutils-python-2.2.5-15.0.1.el7.x86_64
---> Package policycoreutils.x86_64 0:2.5-29.0.1.el7_6.1 will be an update
--> Processing Dependency: libsemanage >= 2.5-14 for package: policycoreutils-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libsepol >= 2.5-10 for package: policycoreutils-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libselinux-utils >= 2.5-14 for package: policycoreutils-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libsepol.so.1(LIBSEPOL_1.1)(64bit) for package: policycoreutils-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libsemanage.so.1(LIBSEMANAGE_1.1)(64bit) for package: policycoreutils-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libsepol.so.1(LIBSEPOL_1.0)(64bit) for package: policycoreutils-2.5-29.0.1.el7_6.1.x86_64
---> Package selinux-policy.noarch 0:3.13.1-23.0.1.el7 will be updated
---> Package selinux-policy.noarch 0:3.13.1-229.0.3.el7_6.12 will be an update
---> Package selinux-policy-targeted.noarch 0:3.13.1-23.0.1.el7 will be updated
---> Package selinux-policy-targeted.noarch 0:3.13.1-229.0.3.el7_6.12 will be an update
---> Package systemd.x86_64 0:208-20.0.1.el7 will be updated
--> Processing Dependency: systemd = 208-20.0.1.el7 for package: libgudev1-208-20.0.1.el7.x86_64
--> Processing Dependency: systemd = 208-20.0.1.el7 for package: systemd-sysv-208-20.0.1.el7.x86_64
--> Processing Dependency: systemd = 208-20.0.1.el7 for package: systemd-python-208-20.0.1.el7.x86_64
---> Package systemd.x86_64 0:219-62.0.4.el7_6.7 will be an update
--> Processing Dependency: kmod >= 18-4 for package: systemd-219-62.0.4.el7_6.7.x86_64
--> Processing Dependency: libcryptsetup.so.12(CRYPTSETUP_2.0)(64bit) for package: systemd-219-62.0.4.el7_6.7.x86_64
--> Processing Dependency: libcryptsetup.so.12()(64bit) for package: systemd-219-62.0.4.el7_6.7.x86_64
--> Running transaction check
---> Package cryptsetup-libs.x86_64 0:1.6.6-3.el7 will be updated
--> Processing Dependency: cryptsetup-libs = 1.6.6-3.el7 for package: cryptsetup-python-1.6.6-3.el7.x86_64
--> Processing Dependency: cryptsetup-libs(x86-64) = 1.6.6-3.el7 for package: cryptsetup-1.6.6-3.el7.x86_64
---> Package cryptsetup-libs.x86_64 0:2.0.3-3.el7 will be an update
---> Package device-mapper-event.x86_64 7:1.02.93-3.el7 will be updated
--> Processing Dependency: device-mapper-event = 7:1.02.93-3.el7 for package: 7:lvm2-libs-2.02.115-3.el7.x86_64
---> Package device-mapper-event.x86_64 7:1.02.149-10.0.3.el7_6.8 will be an update
--> Processing Dependency: device-mapper-event-libs = 7:1.02.149-10.0.3.el7_6.8 for package: 7:device-mapper-event-1.02.149-10.0.3.el7_6.8.x86_64
---> Package kmod.x86_64 0:14-10.el7 will be updated
---> Package kmod.x86_64 0:20-23.0.1.el7 will be an update
---> Package libgudev1.x86_64 0:208-20.0.1.el7 will be updated
---> Package libgudev1.x86_64 0:219-62.0.4.el7_6.7 will be an update
--> Processing Dependency: glib2 >= 2.42 for package: libgudev1-219-62.0.4.el7_6.7.x86_64
---> Package libnet.x86_64 0:1.1.6-7.el7 will be installed
---> Package libnl3.x86_64 0:3.2.21-8.0.1.el7 will be updated
--> Processing Dependency: libnl3 = 3.2.21-8.0.1.el7 for package: libnl3-cli-3.2.21-8.0.1.el7.x86_64
---> Package libnl3.x86_64 0:3.2.28-4.el7 will be an update
---> Package libselinux-utils.x86_64 0:2.2.2-6.el7 will be updated
---> Package libselinux-utils.x86_64 0:2.5-14.1.el7 will be an update
--> Processing Dependency: libselinux(x86-64) = 2.5-14.1.el7 for package: libselinux-utils-2.5-14.1.el7.x86_64
---> Package libsemanage.x86_64 0:2.1.10-16.el7 will be updated
--> Processing Dependency: libsemanage = 2.1.10-16.el7 for package: libsemanage-python-2.1.10-16.el7.x86_64
---> Package libsemanage.x86_64 0:2.5-14.el7 will be an update
---> Package libsepol.x86_64 0:2.1.9-3.el7 will be updated
---> Package libsepol.x86_64 0:2.5-10.el7 will be an update
---> Package policycoreutils-python.x86_64 0:2.2.5-15.0.1.el7 will be updated
---> Package policycoreutils-python.x86_64 0:2.5-29.0.1.el7_6.1 will be an update
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64
---> Package protobuf-c.x86_64 0:1.0.2-3.el7 will be installed
---> Package systemd-python.x86_64 0:208-20.0.1.el7 will be updated
---> Package systemd-python.x86_64 0:219-62.0.4.el7_6.7 will be an update
---> Package systemd-sysv.x86_64 0:208-20.0.1.el7 will be updated
---> Package systemd-sysv.x86_64 0:219-62.0.4.el7_6.7 will be an update
--> Running transaction check
---> Package cryptsetup.x86_64 0:1.6.6-3.el7 will be updated
---> Package cryptsetup.x86_64 0:2.0.3-3.el7 will be an update
---> Package cryptsetup-python.x86_64 0:1.6.6-3.el7 will be updated
---> Package cryptsetup-python.x86_64 0:2.0.3-3.el7 will be an update
---> Package device-mapper-event-libs.x86_64 7:1.02.93-3.el7 will be updated
---> Package device-mapper-event-libs.x86_64 7:1.02.149-10.0.3.el7_6.8 will be an update
---> Package glib2.x86_64 0:2.40.0-4.el7 will be updated
---> Package glib2.x86_64 0:2.56.1-4.el7_6 will be an update
---> Package libnl3-cli.x86_64 0:3.2.21-8.0.1.el7 will be updated
---> Package libnl3-cli.x86_64 0:3.2.28-4.el7 will be an update
---> Package libselinux.x86_64 0:2.2.2-6.el7 will be updated
--> Processing Dependency: libselinux = 2.2.2-6.el7 for package: libselinux-python-2.2.2-6.el7.x86_64
---> Package libselinux.x86_64 0:2.5-14.1.el7 will be an update
---> Package libsemanage-python.x86_64 0:2.1.10-16.el7 will be updated
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be an update
---> Package lvm2-libs.x86_64 7:2.02.115-3.el7 will be updated
--> Processing Dependency: lvm2-libs = 7:2.02.115-3.el7 for package: 7:lvm2-2.02.115-3.el7.x86_64
--> Processing Dependency: lvm2-libs = 7:2.02.115-3.el7 for package: 7:lvm2-python-libs-2.02.115-3.el7.x86_64
---> Package lvm2-libs.x86_64 7:2.02.180-10.0.3.el7_6.8 will be an update
---> Package setools-libs.x86_64 0:3.3.7-46.el7 will be updated
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be an update
--> Running transaction check
---> Package libselinux-python.x86_64 0:2.2.2-6.el7 will be updated
---> Package libselinux-python.x86_64 0:2.5-14.1.el7 will be an update
---> Package lvm2.x86_64 7:2.02.115-3.el7 will be updated
---> Package lvm2.x86_64 7:2.02.180-10.0.3.el7_6.8 will be an update
--> Processing Dependency: device-mapper-persistent-data >= 0.7.0-0.1.rc6 for package: 7:lvm2-2.02.180-10.0.3.el7_6.8.x86_64
---> Package lvm2-python-libs.x86_64 7:2.02.115-3.el7 will be updated
---> Package lvm2-python-libs.x86_64 7:2.02.180-10.0.3.el7_6.8 will be an update
--> Running transaction check
---> Package device-mapper-persistent-data.x86_64 0:0.4.1-2.el7 will be updated
---> Package device-mapper-persistent-data.x86_64 0:0.7.3-3.el7 will be an update
--> Processing Conflict: systemd-219-62.0.4.el7_6.7.x86_64 conflicts initscripts < 9.49.28-1
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package initscripts.x86_64 0:9.49.24-1.0.1.el7 will be updated
---> Package initscripts.x86_64 0:9.49.46-1.0.1.el7 will be an update
--> Processing Conflict: initscripts-9.49.46-1.0.1.el7.x86_64 conflicts redhat-release < 7.5-0.11
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package redhat-release-server.x86_64 1:7.1-1.0.2.el7 will be updated
---> Package redhat-release-server.x86_64 1:7.6-4.0.1.el7 will be an update
--> Processing Conflict: initscripts-9.49.46-1.0.1.el7.x86_64 conflicts oraclelinux-release < 7:7.5-1.0.3
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package oraclelinux-release.x86_64 7:7.1-1.0.5.el7 will be updated
---> Package oraclelinux-release.x86_64 7:7.6-1.0.15.el7 will be an update
--> Processing Conflict: systemd-219-62.0.4.el7_6.7.x86_64 conflicts dracut < 033-243
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package dracut.x86_64 0:033-240.0.1.el7 will be updated
--> Processing Dependency: dracut = 033-240.0.1.el7 for package: dracut-config-rescue-033-240.0.1.el7.x86_64
--> Processing Dependency: dracut = 033-240.0.1.el7 for package: dracut-network-033-240.0.1.el7.x86_64
---> Package dracut.x86_64 0:033-554.0.3.el7 will be an update
--> Running transaction check
---> Package dracut-config-rescue.x86_64 0:033-240.0.1.el7 will be updated
---> Package dracut-config-rescue.x86_64 0:033-554.0.3.el7 will be an update
---> Package dracut-network.x86_64 0:033-240.0.1.el7 will be updated
---> Package dracut-network.x86_64 0:033-554.0.3.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================================================
 Package                                                            Arch                                        Version                                                               Repository                                       Size
============================================================================================================================================================================================================================================
Installing:
 docker-engine                                                      x86_64                                      18.09.1.ol-1.0.5.el7                                                  ol7_addons                                       19 M
Updating:
 dracut                                                             x86_64                                      033-554.0.3.el7                                                       ol7_latest                                      328 k
 initscripts                                                        x86_64                                      9.49.46-1.0.1.el7                                                     ol7_latest                                      439 k
 oraclelinux-release                                                x86_64                                      7:7.6-1.0.15.el7                                                      ol7_latest                                       54 k
 redhat-release-server                                              x86_64                                      1:7.6-4.0.1.el7                                                       ol7_latest                                      9.8 k
Installing for dependencies:
 container-selinux                                                  noarch                                      2:2.77-5.el7                                                          ol7_addons                                       37 k
 containerd                                                         x86_64                                      1.2.0-1.0.5.el7                                                       ol7_addons                                       21 M
 criu                                                               x86_64                                      3.9-5.el7                                                             ol7_latest                                      432 k
 docker-cli                                                         x86_64                                      18.09.1.ol-1.0.5.el7                                                  ol7_addons                                       14 M
 libnet                                                             x86_64                                      1.1.6-7.el7                                                           ol7_latest                                       57 k
 lz4                                                                x86_64                                      1.7.5-2.0.1.el7                                                       ol7_latest                                       98 k
 protobuf-c                                                         x86_64                                      1.0.2-3.el7                                                           ol7_latest                                       27 k
 runc                                                               x86_64                                      1.0.0-19.rc5.git4bb1fe4.0.3.el7                                       ol7_addons                                      1.9 M
Updating for dependencies:
 cryptsetup                                                         x86_64                                      2.0.3-3.el7                                                           ol7_latest                                      153 k
 cryptsetup-libs                                                    x86_64                                      2.0.3-3.el7                                                           ol7_latest                                      337 k
 cryptsetup-python                                                  x86_64                                      2.0.3-3.el7                                                           ol7_latest                                       35 k
 device-mapper                                                      x86_64                                      7:1.02.149-10.0.3.el7_6.8                                             ol7_latest                                      293 k
 device-mapper-event                                                x86_64                                      7:1.02.149-10.0.3.el7_6.8                                             ol7_latest                                      188 k
 device-mapper-event-libs                                           x86_64                                      7:1.02.149-10.0.3.el7_6.8                                             ol7_latest                                      188 k
 device-mapper-libs                                                 x86_64                                      7:1.02.149-10.0.3.el7_6.8                                             ol7_latest                                      320 k
 device-mapper-persistent-data                                      x86_64                                      0.7.3-3.el7                                                           ol7_latest                                      404 k
 dracut-config-rescue                                               x86_64                                      033-554.0.3.el7                                                       ol7_latest                                       60 k
 dracut-network                                                     x86_64                                      033-554.0.3.el7                                                       ol7_latest                                      102 k
 glib2                                                              x86_64                                      2.56.1-4.el7_6                                                        ol7_latest                                      2.5 M
 kmod                                                               x86_64                                      20-23.0.1.el7                                                         ol7_latest                                      121 k
 libgudev1                                                          x86_64                                      219-62.0.4.el7_6.7                                                    ol7_latest                                       96 k
 libnl3                                                             x86_64                                      3.2.28-4.el7                                                          ol7_latest                                      277 k
 libnl3-cli                                                         x86_64                                      3.2.28-4.el7                                                          ol7_latest                                      159 k
 libseccomp                                                         x86_64                                      2.3.1-3.el7                                                           ol7_latest                                       55 k
 libselinux                                                         x86_64                                      2.5-14.1.el7                                                          ol7_latest                                      162 k
 libselinux-python                                                  x86_64                                      2.5-14.1.el7                                                          ol7_latest                                      235 k
 libselinux-utils                                                   x86_64                                      2.5-14.1.el7                                                          ol7_latest                                      151 k
 libsemanage                                                        x86_64                                      2.5-14.el7                                                            ol7_latest                                      150 k
 libsemanage-python                                                 x86_64                                      2.5-14.el7                                                            ol7_latest                                      112 k
 libsepol                                                           x86_64                                      2.5-10.el7                                                            ol7_latest                                      297 k
 lvm2                                                               x86_64                                      7:2.02.180-10.0.3.el7_6.8                                             ol7_latest                                      1.3 M
 lvm2-libs                                                          x86_64                                      7:2.02.180-10.0.3.el7_6.8                                             ol7_latest                                      1.1 M
 lvm2-python-libs                                                   x86_64                                      7:2.02.180-10.0.3.el7_6.8                                             ol7_latest                                      186 k
 policycoreutils                                                    x86_64                                      2.5-29.0.1.el7_6.1                                                    ol7_latest                                      916 k
 policycoreutils-python                                             x86_64                                      2.5-29.0.1.el7_6.1                                                    ol7_latest                                      455 k
 selinux-policy                                                     noarch                                      3.13.1-229.0.3.el7_6.12                                               ol7_latest                                      484 k
 selinux-policy-targeted                                            noarch                                      3.13.1-229.0.3.el7_6.12                                               ol7_latest                                      6.9 M
 setools-libs                                                       x86_64                                      3.3.8-4.el7                                                           ol7_latest                                      620 k
 systemd                                                            x86_64                                      219-62.0.4.el7_6.7                                                    ol7_latest                                      5.1 M
 systemd-libs                                                       x86_64                                      219-62.0.4.el7_6.7                                                    ol7_latest                                      407 k
 systemd-python                                                     x86_64                                      219-62.0.4.el7_6.7                                                    ol7_latest                                      133 k
 systemd-sysv                                                       x86_64                                      219-62.0.4.el7_6.7                                                    ol7_latest                                       84 k

Transaction Summary
============================================================================================================================================================================================================================================
Install  1 Package  (+ 8 Dependent packages)
Upgrade  4 Packages (+34 Dependent packages)

Total download size: 81 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for ol7_latest
warning: /var/cache/yum/x86_64/7Server/ol7_latest/packages/cryptsetup-2.0.3-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY                                                      ] 373 kB/s | 1.6 MB  00:03:39 ETA
Public key for cryptsetup-2.0.3-3.el7.x86_64.rpm is not installed
(1/47): cryptsetup-2.0.3-3.el7.x86_64.rpm                                                                                                                                                                            | 153 kB  00:00:04
(2/47): criu-3.9-5.el7.x86_64.rpm                                                                                                                                                                                    | 432 kB  00:00:04
Public key for container-selinux-2.77-5.el7.noarch.rpm is not installed
(3/47): container-selinux-2.77-5.el7.noarch.rpm                                                                                                                                                                      |  37 kB  00:00:04
(4/47): cryptsetup-python-2.0.3-3.el7.x86_64.rpm                                                                                                                                                                     |  35 kB  00:00:00
(5/47): cryptsetup-libs-2.0.3-3.el7.x86_64.rpm                                                                                                                                                                       | 337 kB  00:00:01
(6/47): device-mapper-event-1.02.149-10.0.3.el7_6.8.x86_64.rpm                                                                                                                                                       | 188 kB  00:00:00
(7/47): device-mapper-1.02.149-10.0.3.el7_6.8.x86_64.rpm                                                                                                                                                             | 293 kB  00:00:01
(8/47): device-mapper-event-libs-1.02.149-10.0.3.el7_6.8.x86_64.rpm                                                                                                                                                  | 188 kB  00:00:00
(9/47): device-mapper-persistent-data-0.7.3-3.el7.x86_64.rpm                                                                                                                                                         | 404 kB  00:00:00
(10/47): device-mapper-libs-1.02.149-10.0.3.el7_6.8.x86_64.rpm                                                                                                                                                       | 320 kB  00:00:02
(11/47): containerd-1.2.0-1.0.5.el7.x86_64.rpm                                                                                                                                                                       |  21 MB  00:00:13
(12/47): dracut-config-rescue-033-554.0.3.el7.x86_64.rpm                                                                                                                                                             |  60 kB  00:00:01
(13/47): dracut-network-033-554.0.3.el7.x86_64.rpm                                                                                                                                                                   | 102 kB  00:00:00
(14/47): dracut-033-554.0.3.el7.x86_64.rpm                                                                                                                                                                           | 328 kB  00:00:02
(15/47): initscripts-9.49.46-1.0.1.el7.x86_64.rpm                                                                                                                                                                    | 439 kB  00:00:00
(16/47): kmod-20-23.0.1.el7.x86_64.rpm                                                                                                                                                                               | 121 kB  00:00:00
(17/47): libgudev1-219-62.0.4.el7_6.7.x86_64.rpm                                                                                                                                                                     |  96 kB  00:00:00
(18/47): glib2-2.56.1-4.el7_6.x86_64.rpm                                                                                                                                                                             | 2.5 MB  00:00:02
(19/47): libnl3-3.2.28-4.el7.x86_64.rpm                                                                                                                                                                              | 277 kB  00:00:00
(20/47): docker-cli-18.09.1.ol-1.0.5.el7.x86_64.rpm                                                                                                                                                                  |  14 MB  00:00:12
(21/47): libnet-1.1.6-7.el7.x86_64.rpm                                                                                                                                                                               |  57 kB  00:00:01
(22/47): libseccomp-2.3.1-3.el7.x86_64.rpm                                                                                                                                                                           |  55 kB  00:00:00
(23/47): libselinux-2.5-14.1.el7.x86_64.rpm                                                                                                                                                                          | 162 kB  00:00:00
(24/47): libnl3-cli-3.2.28-4.el7.x86_64.rpm                                                                                                                                                                          | 159 kB  00:00:00
(25/47): libselinux-python-2.5-14.1.el7.x86_64.rpm                                                                                                                                                                   | 235 kB  00:00:00
(26/47): libselinux-utils-2.5-14.1.el7.x86_64.rpm                                                                                                                                                                    | 151 kB  00:00:00
(27/47): libsemanage-python-2.5-14.el7.x86_64.rpm                                                                                                                                                                    | 112 kB  00:00:00
(28/47): libsemanage-2.5-14.el7.x86_64.rpm                                                                                                                                                                           | 150 kB  00:00:00
(29/47): libsepol-2.5-10.el7.x86_64.rpm                                                                                                                                                                              | 297 kB  00:00:00
(30/47): lvm2-2.02.180-10.0.3.el7_6.8.x86_64.rpm                                                                                                                                                                     | 1.3 MB  00:00:00
(31/47): lvm2-python-libs-2.02.180-10.0.3.el7_6.8.x86_64.rpm                                                                                                                                                         | 186 kB  00:00:00
(32/47): lvm2-libs-2.02.180-10.0.3.el7_6.8.x86_64.rpm                                                                                                                                                                | 1.1 MB  00:00:01
(33/47): lz4-1.7.5-2.0.1.el7.x86_64.rpm                                                                                                                                                                              |  98 kB  00:00:00
(34/47): oraclelinux-release-7.6-1.0.15.el7.x86_64.rpm                                                                                                                                                               |  54 kB  00:00:00
(35/47): policycoreutils-2.5-29.0.1.el7_6.1.x86_64.rpm                                                                                                                                                               | 916 kB  00:00:00
(36/47): policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64.rpm                                                                                                                                                        | 455 kB  00:00:00
(37/47): redhat-release-server-7.6-4.0.1.el7.x86_64.rpm                                                                                                                                                              | 9.8 kB  00:00:00
(38/47): docker-engine-18.09.1.ol-1.0.5.el7.x86_64.rpm                                                                                                                                                               |  19 MB  00:00:10
(39/47): selinux-policy-3.13.1-229.0.3.el7_6.12.noarch.rpm                                                                                                                                                           | 484 kB  00:00:00
(40/47): protobuf-c-1.0.2-3.el7.x86_64.rpm                                                                                                                                                                           |  27 kB  00:00:02
(41/47): setools-libs-3.3.8-4.el7.x86_64.rpm                                                                                                                                                                         | 620 kB  00:00:00
(42/47): runc-1.0.0-19.rc5.git4bb1fe4.0.3.el7.x86_64.rpm                                                                                                                                                             | 1.9 MB  00:00:04
(43/47): selinux-policy-targeted-3.13.1-229.0.3.el7_6.12.noarch.rpm                                                                                                                                                  | 6.9 MB  00:00:03
(44/47): systemd-libs-219-62.0.4.el7_6.7.x86_64.rpm                                                                                                                                                                  | 407 kB  00:00:00
(45/47): systemd-python-219-62.0.4.el7_6.7.x86_64.rpm                                                                                                                                                                | 133 kB  00:00:00
(46/47): systemd-sysv-219-62.0.4.el7_6.7.x86_64.rpm                                                                                                                                                                  |  84 kB  00:00:00
(47/47): systemd-219-62.0.4.el7_6.7.x86_64.rpm                                                                                                                                                                       | 5.1 MB  00:00:04
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                       2.8 MB/s |  81 MB  00:00:29
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Importing GPG key 0xEC551F03:
 Userid     : "Oracle OSS group (Open Source Software group) "
 Fingerprint: 4214 4123 fecf c55b 9086 313d 72f9 7b74 ec55 1f03
 Package    : 7:oraclelinux-release-7.1-1.0.5.el7.x86_64 (@anaconda/7.1)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libsepol-2.5-10.el7.x86_64                                                                                                                                                                                              1/85
  Updating   : libselinux-2.5-14.1.el7.x86_64                                                                                                                                                                                          2/85
  Updating   : libsemanage-2.5-14.el7.x86_64                                                                                                                                                                                           3/85
  Installing : lz4-1.7.5-2.0.1.el7.x86_64                                                                                                                                                                                              4/85
  Updating   : systemd-libs-219-62.0.4.el7_6.7.x86_64                                                                                                                                                                                  5/85
  Updating   : 1:redhat-release-server-7.6-4.0.1.el7.x86_64                                                                                                                                                                            6/85
  Updating   : cryptsetup-libs-2.0.3-3.el7.x86_64                                                                                                                                                                                      7/85
  Updating   : 7:device-mapper-libs-1.02.149-10.0.3.el7_6.8.x86_64                                                                                                                                                                     8/85
  Updating   : 7:device-mapper-1.02.149-10.0.3.el7_6.8.x86_64                                                                                                                                                                          9/85
  Updating   : systemd-219-62.0.4.el7_6.7.x86_64                                                                                                                                                                                      10/85
  Updating   : dracut-033-554.0.3.el7.x86_64                                                                                                                                                                                          11/85
  Updating   : kmod-20-23.0.1.el7.x86_64                                                                                                                                                                                              12/85
  Updating   : 7:device-mapper-event-libs-1.02.149-10.0.3.el7_6.8.x86_64                                                                                                                                                              13/85
  Updating   : libseccomp-2.3.1-3.el7.x86_64                                                                                                                                                                                          14/85
  Updating   : glib2-2.56.1-4.el7_6.x86_64                                                                                                                                                                                            15/85
  Updating   : libselinux-utils-2.5-14.1.el7.x86_64                                                                                                                                                                                   16/85
  Updating   : policycoreutils-2.5-29.0.1.el7_6.1.x86_64                                                                                                                                                                              17/85
  Updating   : selinux-policy-3.13.1-229.0.3.el7_6.12.noarch                                                                                                                                                                          18/85
  Updating   : libnl3-3.2.28-4.el7.x86_64                                                                                                                                                                                             19/85
  Updating   : selinux-policy-targeted-3.13.1-229.0.3.el7_6.12.noarch                                                                                                                                                                 20/85
  Updating   : 7:device-mapper-event-1.02.149-10.0.3.el7_6.8.x86_64                                                                                                                                                                   21/85
  Updating   : 7:lvm2-libs-2.02.180-10.0.3.el7_6.8.x86_64                                                                                                                                                                             22/85
  Updating   : 7:oraclelinux-release-7.6-1.0.15.el7.x86_64                                                                                                                                                                            23/85
  Updating   : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                                                                   24/85
  Updating   : libselinux-python-2.5-14.1.el7.x86_64                                                                                                                                                                                  25/85
  Updating   : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                                                        26/85
  Updating   : policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64                                                                                                                                                                       27/85
  Installing : 2:container-selinux-2.77-5.el7.noarch                                                                                                                                                                                  28/85
  Installing : containerd-1.2.0-1.0.5.el7.x86_64                                                                                                                                                                                      29/85
  Installing : docker-cli-18.09.1.ol-1.0.5.el7.x86_64                                                                                                                                                                                 30/85
  Installing : libnet-1.1.6-7.el7.x86_64                                                                                                                                                                                              31/85
  Installing : protobuf-c-1.0.2-3.el7.x86_64                                                                                                                                                                                          32/85
  Installing : criu-3.9-5.el7.x86_64                                                                                                                                                                                                  33/85
  Installing : runc-1.0.0-19.rc5.git4bb1fe4.0.3.el7.x86_64                                                                                                                                                                            34/85
  Updating   : device-mapper-persistent-data-0.7.3-3.el7.x86_64                                                                                                                                                                       35/85
  Updating   : 7:lvm2-2.02.180-10.0.3.el7_6.8.x86_64                                                                                                                                                                                  36/85
Created symlink from /etc/systemd/system/sysinit.target.wants/lvm2-lvmpolld.socket to /usr/lib/systemd/system/lvm2-lvmpolld.socket.
  Installing : docker-engine-18.09.1.ol-1.0.5.el7.x86_64                                                                                                                                                                              37/85
  Updating   : initscripts-9.49.46-1.0.1.el7.x86_64                                                                                                                                                                                   38/85
  Updating   : 7:lvm2-python-libs-2.02.180-10.0.3.el7_6.8.x86_64                                                                                                                                                                      39/85
  Updating   : libnl3-cli-3.2.28-4.el7.x86_64                                                                                                                                                                                         40/85
  Updating   : libgudev1-219-62.0.4.el7_6.7.x86_64                                                                                                                                                                                    41/85
  Updating   : dracut-network-033-554.0.3.el7.x86_64                                                                                                                                                                                  42/85
  Updating   : dracut-config-rescue-033-554.0.3.el7.x86_64                                                                                                                                                                            43/85
  Updating   : systemd-sysv-219-62.0.4.el7_6.7.x86_64                                                                                                                                                                                 44/85
  Updating   : systemd-python-219-62.0.4.el7_6.7.x86_64                                                                                                                                                                               45/85
  Updating   : cryptsetup-python-2.0.3-3.el7.x86_64                                                                                                                                                                                   46/85
  Updating   : cryptsetup-2.0.3-3.el7.x86_64                                                                                                                                                                                          47/85
  Cleanup    : 7:lvm2-2.02.115-3.el7.x86_64                                                                                                                                                                                           48/85
  Cleanup    : policycoreutils-python-2.2.5-15.0.1.el7.x86_64                                                                                                                                                                         49/85

UPGRADE: Automatically re-enabling default systemd units:
        brandbot.path
        rhel-autorelabel.service
        rhel-autorelabel-mark.service
        rhel-configure.service
        rhel-dmesg.service
        rhel-domainname.service
        rhel-import-state.service
        rhel-loadmodules.service
        rhel-readonly.service

  Cleanup    : initscripts-9.49.24-1.0.1.el7.x86_64                                                                                                                                                                                   50/85
  Cleanup    : libgudev1-208-20.0.1.el7.x86_64                                                                                                                                                                                        51/85
  Cleanup    : selinux-policy-targeted-3.13.1-23.0.1.el7.noarch                                                                                                                                                                       52/85
  Cleanup    : selinux-policy-3.13.1-23.0.1.el7.noarch                                                                                                                                                                                53/85
  Cleanup    : 7:oraclelinux-release-7.1-1.0.5.el7.x86_64                                                                                                                                                                             54/85
  Cleanup    : dracut-config-rescue-033-240.0.1.el7.x86_64                                                                                                                                                                            55/85
  Cleanup    : systemd-sysv-208-20.0.1.el7.x86_64                                                                                                                                                                                     56/85
  Cleanup    : dracut-network-033-240.0.1.el7.x86_64                                                                                                                                                                                  57/85
  Cleanup    : policycoreutils-2.2.5-15.0.1.el7.x86_64                                                                                                                                                                                58/85
  Cleanup    : systemd-python-208-20.0.1.el7.x86_64                                                                                                                                                                                   59/85
  Cleanup    : dracut-033-240.0.1.el7.x86_64                                                                                                                                                                                          60/85
  Cleanup    : setools-libs-3.3.7-46.el7.x86_64                                                                                                                                                                                       61/85
  Cleanup    : libselinux-utils-2.2.2-6.el7.x86_64                                                                                                                                                                                    62/85
  Cleanup    : glib2-2.40.0-4.el7.x86_64                                                                                                                                                                                              63/85
  Cleanup    : libselinux-python-2.2.2-6.el7.x86_64                                                                                                                                                                                   64/85
  Cleanup    : libsemanage-python-2.1.10-16.el7.x86_64                                                                                                                                                                                65/85
  Cleanup    : libsemanage-2.1.10-16.el7.x86_64                                                                                                                                                                                       66/85
  Cleanup    : cryptsetup-1.6.6-3.el7.x86_64                                                                                                                                                                                          67/85
  Cleanup    : libnl3-cli-3.2.21-8.0.1.el7.x86_64                                                                                                                                                                                     68/85
  Cleanup    : cryptsetup-python-1.6.6-3.el7.x86_64                                                                                                                                                                                   69/85
  Cleanup    : 7:lvm2-python-libs-2.02.115-3.el7.x86_64                                                                                                                                                                               70/85
  Cleanup    : 7:lvm2-libs-2.02.115-3.el7.x86_64                                                                                                                                                                                      71/85
  Cleanup    : 7:device-mapper-event-1.02.93-3.el7.x86_64                                                                                                                                                                             72/85
  Cleanup    : 7:device-mapper-event-libs-1.02.93-3.el7.x86_64                                                                                                                                                                        73/85
  Cleanup    : cryptsetup-libs-1.6.6-3.el7.x86_64                                                                                                                                                                                     74/85
  Cleanup    : systemd-208-20.0.1.el7.x86_64                                                                                                                                                                                          75/85
  Cleanup    : 7:device-mapper-1.02.93-3.el7.x86_64                                                                                                                                                                                   76/85
  Cleanup    : 7:device-mapper-libs-1.02.93-3.el7.x86_64                                                                                                                                                                              77/85
  Cleanup    : 1:redhat-release-server-7.1-1.0.2.el7.x86_64                                                                                                                                                                           78/85
  Cleanup    : systemd-libs-208-20.0.1.el7.x86_64                                                                                                                                                                                     79/85
  Cleanup    : libselinux-2.2.2-6.el7.x86_64                                                                                                                                                                                          80/85
  Cleanup    : libsepol-2.1.9-3.el7.x86_64                                                                                                                                                                                            81/85
  Cleanup    : kmod-14-10.el7.x86_64                                                                                                                                                                                                  82/85
  Cleanup    : libnl3-3.2.21-8.0.1.el7.x86_64                                                                                                                                                                                         83/85
  Cleanup    : device-mapper-persistent-data-0.4.1-2.el7.x86_64                                                                                                                                                                       84/85
  Cleanup    : libseccomp-2.1.1-2.el7.x86_64                                                                                                                                                                                          85/85
  Verifying  : 7:device-mapper-event-libs-1.02.149-10.0.3.el7_6.8.x86_64                                                                                                                                                               1/85
  Verifying  : glib2-2.56.1-4.el7_6.x86_64                                                                                                                                                                                             2/85
  Verifying  : docker-engine-18.09.1.ol-1.0.5.el7.x86_64                                                                                                                                                                               3/85
  Verifying  : policycoreutils-2.5-29.0.1.el7_6.1.x86_64                                                                                                                                                                               4/85
  Verifying  : libseccomp-2.3.1-3.el7.x86_64                                                                                                                                                                                           5/85
  Verifying  : kmod-20-23.0.1.el7.x86_64                                                                                                                                                                                               6/85
  Verifying  : 7:device-mapper-libs-1.02.149-10.0.3.el7_6.8.x86_64                                                                                                                                                                     7/85
  Verifying  : 7:lvm2-python-libs-2.02.180-10.0.3.el7_6.8.x86_64                                                                                                                                                                       8/85
  Verifying  : libgudev1-219-62.0.4.el7_6.7.x86_64                                                                                                                                                                                     9/85
  Verifying  : cryptsetup-libs-2.0.3-3.el7.x86_64                                                                                                                                                                                     10/85
  Verifying  : selinux-policy-3.13.1-229.0.3.el7_6.12.noarch                                                                                                                                                                          11/85
  Verifying  : 7:lvm2-2.02.180-10.0.3.el7_6.8.x86_64                                                                                                                                                                                  12/85
  Verifying  : 2:container-selinux-2.77-5.el7.noarch                                                                                                                                                                                  13/85
  Verifying  : initscripts-9.49.46-1.0.1.el7.x86_64                                                                                                                                                                                   14/85
  Verifying  : cryptsetup-python-2.0.3-3.el7.x86_64                                                                                                                                                                                   15/85
  Verifying  : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                                                                   16/85
  Verifying  : 1:redhat-release-server-7.6-4.0.1.el7.x86_64                                                                                                                                                                           17/85
  Verifying  : 7:oraclelinux-release-7.6-1.0.15.el7.x86_64                                                                                                                                                                            18/85
  Verifying  : device-mapper-persistent-data-0.7.3-3.el7.x86_64                                                                                                                                                                       19/85
  Verifying  : dracut-network-033-554.0.3.el7.x86_64                                                                                                                                                                                  20/85
  Verifying  : systemd-sysv-219-62.0.4.el7_6.7.x86_64                                                                                                                                                                                 21/85
  Verifying  : containerd-1.2.0-1.0.5.el7.x86_64                                                                                                                                                                                      22/85
  Verifying  : policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64                                                                                                                                                                       23/85
  Verifying  : protobuf-c-1.0.2-3.el7.x86_64                                                                                                                                                                                          24/85
  Verifying  : dracut-config-rescue-033-554.0.3.el7.x86_64                                                                                                                                                                            25/85
  Verifying  : libselinux-2.5-14.1.el7.x86_64                                                                                                                                                                                         26/85
  Verifying  : systemd-219-62.0.4.el7_6.7.x86_64                                                                                                                                                                                      27/85
  Verifying  : criu-3.9-5.el7.x86_64                                                                                                                                                                                                  28/85
  Verifying  : libsemanage-2.5-14.el7.x86_64                                                                                                                                                                                          29/85
  Verifying  : systemd-libs-219-62.0.4.el7_6.7.x86_64                                                                                                                                                                                 30/85
  Verifying  : libnl3-cli-3.2.28-4.el7.x86_64                                                                                                                                                                                         31/85
  Verifying  : systemd-python-219-62.0.4.el7_6.7.x86_64                                                                                                                                                                               32/85
  Verifying  : libselinux-python-2.5-14.1.el7.x86_64                                                                                                                                                                                  33/85
  Verifying  : libnet-1.1.6-7.el7.x86_64                                                                                                                                                                                              34/85
  Verifying  : libsepol-2.5-10.el7.x86_64                                                                                                                                                                                             35/85
  Verifying  : runc-1.0.0-19.rc5.git4bb1fe4.0.3.el7.x86_64                                                                                                                                                                            36/85
  Verifying  : selinux-policy-targeted-3.13.1-229.0.3.el7_6.12.noarch                                                                                                                                                                 37/85
  Verifying  : libselinux-utils-2.5-14.1.el7.x86_64                                                                                                                                                                                   38/85
  Verifying  : dracut-033-554.0.3.el7.x86_64                                                                                                                                                                                          39/85
  Verifying  : 7:device-mapper-event-1.02.149-10.0.3.el7_6.8.x86_64                                                                                                                                                                   40/85
  Verifying  : 7:device-mapper-1.02.149-10.0.3.el7_6.8.x86_64                                                                                                                                                                         41/85
  Verifying  : libnl3-3.2.28-4.el7.x86_64                                                                                                                                                                                             42/85
  Verifying  : docker-cli-18.09.1.ol-1.0.5.el7.x86_64                                                                                                                                                                                 43/85
  Verifying  : 7:lvm2-libs-2.02.180-10.0.3.el7_6.8.x86_64                                                                                                                                                                             44/85
  Verifying  : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                                                        45/85
  Verifying  : lz4-1.7.5-2.0.1.el7.x86_64                                                                                                                                                                                             46/85
  Verifying  : cryptsetup-2.0.3-3.el7.x86_64                                                                                                                                                                                          47/85
  Verifying  : libselinux-utils-2.2.2-6.el7.x86_64                                                                                                                                                                                    48/85
  Verifying  : libsemanage-python-2.1.10-16.el7.x86_64                                                                                                                                                                                49/85
  Verifying  : dracut-config-rescue-033-240.0.1.el7.x86_64                                                                                                                                                                            50/85
  Verifying  : systemd-libs-208-20.0.1.el7.x86_64                                                                                                                                                                                     51/85
  Verifying  : systemd-sysv-208-20.0.1.el7.x86_64                                                                                                                                                                                     52/85
  Verifying  : policycoreutils-2.2.5-15.0.1.el7.x86_64                                                                                                                                                                                53/85
  Verifying  : policycoreutils-python-2.2.5-15.0.1.el7.x86_64                                                                                                                                                                         54/85
  Verifying  : cryptsetup-python-1.6.6-3.el7.x86_64                                                                                                                                                                                   55/85
  Verifying  : 7:oraclelinux-release-7.1-1.0.5.el7.x86_64                                                                                                                                                                             56/85
  Verifying  : 7:device-mapper-event-libs-1.02.93-3.el7.x86_64                                                                                                                                                                        57/85
  Verifying  : dracut-033-240.0.1.el7.x86_64                                                                                                                                                                                          58/85
  Verifying  : cryptsetup-1.6.6-3.el7.x86_64                                                                                                                                                                                          59/85
  Verifying  : setools-libs-3.3.7-46.el7.x86_64                                                                                                                                                                                       60/85
  Verifying  : initscripts-9.49.24-1.0.1.el7.x86_64                                                                                                                                                                                   61/85
  Verifying  : kmod-14-10.el7.x86_64                                                                                                                                                                                                  62/85
  Verifying  : systemd-python-208-20.0.1.el7.x86_64                                                                                                                                                                                   63/85
  Verifying  : cryptsetup-libs-1.6.6-3.el7.x86_64                                                                                                                                                                                     64/85
  Verifying  : dracut-network-033-240.0.1.el7.x86_64                                                                                                                                                                                  65/85
  Verifying  : glib2-2.40.0-4.el7.x86_64                                                                                                                                                                                              66/85
  Verifying  : libnl3-cli-3.2.21-8.0.1.el7.x86_64                                                                                                                                                                                     67/85
  Verifying  : libnl3-3.2.21-8.0.1.el7.x86_64                                                                                                                                                                                         68/85
  Verifying  : 7:device-mapper-event-1.02.93-3.el7.x86_64                                                                                                                                                                             69/85
  Verifying  : libselinux-python-2.2.2-6.el7.x86_64                                                                                                                                                                                   70/85
  Verifying  : libsemanage-2.1.10-16.el7.x86_64                                                                                                                                                                                       71/85
  Verifying  : libseccomp-2.1.1-2.el7.x86_64                                                                                                                                                                                          72/85
  Verifying  : libsepol-2.1.9-3.el7.x86_64                                                                                                                                                                                            73/85
  Verifying  : 7:lvm2-python-libs-2.02.115-3.el7.x86_64                                                                                                                                                                               74/85
  Verifying  : 7:device-mapper-1.02.93-3.el7.x86_64                                                                                                                                                                                   75/85
  Verifying  : selinux-policy-3.13.1-23.0.1.el7.noarch                                                                                                                                                                                76/85
  Verifying  : libselinux-2.2.2-6.el7.x86_64                                                                                                                                                                                          77/85
  Verifying  : 1:redhat-release-server-7.1-1.0.2.el7.x86_64                                                                                                                                                                           78/85
  Verifying  : libgudev1-208-20.0.1.el7.x86_64                                                                                                                                                                                        79/85
  Verifying  : 7:lvm2-2.02.115-3.el7.x86_64                                                                                                                                                                                           80/85
  Verifying  : 7:lvm2-libs-2.02.115-3.el7.x86_64                                                                                                                                                                                      81/85
  Verifying  : 7:device-mapper-libs-1.02.93-3.el7.x86_64                                                                                                                                                                              82/85
  Verifying  : device-mapper-persistent-data-0.4.1-2.el7.x86_64                                                                                                                                                                       83/85
  Verifying  : selinux-policy-targeted-3.13.1-23.0.1.el7.noarch                                                                                                                                                                       84/85
  Verifying  : systemd-208-20.0.1.el7.x86_64                                                                                                                                                                                          85/85

Installed:
  docker-engine.x86_64 0:18.09.1.ol-1.0.5.el7

Dependency Installed:
  container-selinux.noarch 2:2.77-5.el7     containerd.x86_64 0:1.2.0-1.0.5.el7               criu.x86_64 0:3.9-5.el7     docker-cli.x86_64 0:18.09.1.ol-1.0.5.el7     libnet.x86_64 0:1.1.6-7.el7     lz4.x86_64 0:1.7.5-2.0.1.el7
  protobuf-c.x86_64 0:1.0.2-3.el7           runc.x86_64 0:1.0.0-19.rc5.git4bb1fe4.0.3.el7

Updated:
  dracut.x86_64 0:033-554.0.3.el7                   initscripts.x86_64 0:9.49.46-1.0.1.el7                   oraclelinux-release.x86_64 7:7.6-1.0.15.el7                   redhat-release-server.x86_64 1:7.6-4.0.1.el7

Dependency Updated:
  cryptsetup.x86_64 0:2.0.3-3.el7                              cryptsetup-libs.x86_64 0:2.0.3-3.el7                          cryptsetup-python.x86_64 0:2.0.3-3.el7                  device-mapper.x86_64 7:1.02.149-10.0.3.el7_6.8
  device-mapper-event.x86_64 7:1.02.149-10.0.3.el7_6.8         device-mapper-event-libs.x86_64 7:1.02.149-10.0.3.el7_6.8     device-mapper-libs.x86_64 7:1.02.149-10.0.3.el7_6.8     device-mapper-persistent-data.x86_64 0:0.7.3-3.el7
  dracut-config-rescue.x86_64 0:033-554.0.3.el7                dracut-network.x86_64 0:033-554.0.3.el7                       glib2.x86_64 0:2.56.1-4.el7_6                           kmod.x86_64 0:20-23.0.1.el7
  libgudev1.x86_64 0:219-62.0.4.el7_6.7                        libnl3.x86_64 0:3.2.28-4.el7                                  libnl3-cli.x86_64 0:3.2.28-4.el7                        libseccomp.x86_64 0:2.3.1-3.el7
  libselinux.x86_64 0:2.5-14.1.el7                             libselinux-python.x86_64 0:2.5-14.1.el7                       libselinux-utils.x86_64 0:2.5-14.1.el7                  libsemanage.x86_64 0:2.5-14.el7
  libsemanage-python.x86_64 0:2.5-14.el7                       libsepol.x86_64 0:2.5-10.el7                                  lvm2.x86_64 7:2.02.180-10.0.3.el7_6.8                   lvm2-libs.x86_64 7:2.02.180-10.0.3.el7_6.8
  lvm2-python-libs.x86_64 7:2.02.180-10.0.3.el7_6.8            policycoreutils.x86_64 0:2.5-29.0.1.el7_6.1                   policycoreutils-python.x86_64 0:2.5-29.0.1.el7_6.1      selinux-policy.noarch 0:3.13.1-229.0.3.el7_6.12
  selinux-policy-targeted.noarch 0:3.13.1-229.0.3.el7_6.12     setools-libs.x86_64 0:3.3.8-4.el7                             systemd.x86_64 0:219-62.0.4.el7_6.7                     systemd-libs.x86_64 0:219-62.0.4.el7_6.7
  systemd-python.x86_64 0:219-62.0.4.el7_6.7                   systemd-sysv.x86_64 0:219-62.0.4.el7_6.7

Complete!

3.一旦安装完成,就可以启动docker服务

[root@localhost soft]# service docker start
Redirecting to /bin/systemctl start docker.service

[root@localhost soft]# systemctl enable docker

[root@localhost soft]# service docker status
Redirecting to /bin/systemctl status docker.service
鈼[0m docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/docker.service.d
           鈹斺攢docker-sysconfig.conf
   Active: active (running) since Mon 2019-06-10 23:15:05 CST; 6h left
     Docs: https://docs.docker.com
 Main PID: 1452 (dockerd)
   Memory: 132.2M
   CGroup: /system.slice/docker.service
           鈹溾攢1452 /usr/bin/dockerd --selinux-enabled --storage-driver devicemapper --storage-opt dm.basesize=25G
           鈹斺攢2436 containerd --config /var/run/docker/containerd/containerd.toml --log-level info

Jun 10 23:15:03 localhost.localdomain dockerd[1452]: time="2019-06-10T23:15:03.843382248+08:00" level=info msg="Successfully created filesystem xfs on device docker-253:0-1047242-base" storage-driver=devicemapper
Jun 10 23:15:04 localhost.localdomain dockerd[1452]: time="2019-06-10T23:15:04.076789613+08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Jun 10 23:15:04 localhost.localdomain dockerd[1452]: time="2019-06-10T23:15:04.078665673+08:00" level=warning msg="mountpoint for pids not found"
Jun 10 23:15:04 localhost.localdomain dockerd[1452]: time="2019-06-10T23:15:04.079906275+08:00" level=info msg="Loading containers: start."
Jun 10 23:15:04 localhost.localdomain dockerd[1452]: time="2019-06-10T23:15:04.554467519+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to...rred IP address"
Jun 10 23:15:04 localhost.localdomain dockerd[1452]: time="2019-06-10T23:15:04.859786800+08:00" level=info msg="Loading containers: done."
Jun 10 23:15:04 localhost.localdomain dockerd[1452]: time="2019-06-10T23:15:04.959099871+08:00" level=info msg="Docker daemon" commit=c3ab8a8 graphdriver(s)=devicemapper version=18.09.1-ol
Jun 10 23:15:04 localhost.localdomain dockerd[1452]: time="2019-06-10T23:15:04.959938124+08:00" level=info msg="Daemon has completed initialization"
Jun 10 23:15:05 localhost.localdomain dockerd[1452]: time="2019-06-10T23:15:05.053166130+08:00" level=info msg="API listen on /var/run/docker.sock"
Jun 10 23:15:05 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.

4.然后可以下载镜像文件

[root@localhost soft]# docker pull mysql/mysql-server:5.7
Trying to pull repository docker.io/mysql/mysql-server ...
5.7: Pulling from docker.io/mysql/mysql-server
35defbf6c365: Pull complete
0fa46ab0f51d: Pull complete
f70f5000008c: Pull complete
892ac46af8c0: Pull complete
Digest: sha256:ddb046076781a15200d36cb01f8f512431c3481bedebd5e92646d8c617ae212c
Status: Downloaded newer image for mysql/mysql-server:5.7
[root@localhost soft]# docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
mysql/mysql-server   5.7                 857eadf53a54        6 weeks ago         258MB

到此安装就完成了,还是很简单。

在Oracle Linux 7.1中使用源码来安装PostgreSQL 9.6

在Oracle Linux 7.1中使用源码来安装PostgreSQL 9.6
编译PostgreSQL需要下列软件包:
1.GUN make版本3.80或新的要求。

[root@cs1 /]# make --version
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

2.需要一个ISO/ANSI C 编译器(至少是 C89兼容的)。我们推荐使用最近版本的GCC

[root@cs1 /]# gcc --version
gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9)
Copyright (C) 2013 Free Software Foundation, Inc.
本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保;
包括没有适销性和某一专用目的下的适用性担保。

3.除了gzip和bzip2之外,我们还需要tar来解包源代码发布。

4.GNU Readline库

[root@cs1 /]# rpm -aq | grep readline
readline-6.2-9.el7.x86_64
[root@cs1 /]# rpm -aq | grep readline-deve
readline-devel-6.2-9.el7.x86_64
[root@cs1 /]# rpm -aq | grep libedit
libedit-3.0-12.20121213cvs.el7.x86_64

5.可选工具包在默认配置的时候并不要求它们,但是如果打开了一些编译选项之后就需要它们了

perl 5.8 or later
python
Kerberos
OpenSSL
OpenLDAP and/or PAM
Flex 2.5.31 or later
Bison 1.875 or later

6.创建用户与组

[root@cs1 local]# groupadd pgsql
[root@cs1 local]# useradd -g pgsql pgsql

7.下载源码包postgresql-9.6.6.tar.gz并上传到服务器并解压

[root@cs1 local]# gunzip  postgresql-9.6.6.tar.gz

创建一个软链接

[root@cs1 local]# ln -s postgresql-9.6.6 pgsql
[root@cs1 local]# ls -lrt
总用量 8
drwxr-xr-x.  2 root  root     6 5月   8 2014 src
drwxr-xr-x.  2 root  root     6 5月   8 2014 sbin
drwxr-xr-x.  2 root  root     6 5月   8 2014 libexec
drwxr-xr-x.  2 root  root     6 5月   8 2014 lib64
drwxr-xr-x.  2 root  root     6 5月   8 2014 lib
drwxr-xr-x.  2 root  root     6 5月   8 2014 include
drwxr-xr-x.  2 root  root     6 5月   8 2014 games
drwxr-xr-x.  2 root  root     6 5月   8 2014 etc
drwxr-xr-x.  5 root  root    46 10月 12 2017 share
drwxrwxrwx   6 pgsql pgsql 4096 11月  7 2017 postgresql-9.6.6
drwxr-xr-x.  2 root  root    46 3月   9 2018 bin
drwxrwxr-x  13 root  mysql 4096 1月  31 02:40 mariadb-10.0.38-linux-glibc_214-x86_64
lrwxrwxrwx   1 root  root    38 6月   4 14:43 mysql -> mariadb-10.0.38-linux-glibc_214-x86_64
lrwxrwxrwx   1 root  root    16 6月   4 21:24 pgsql -> postgresql-9.6.6

8.安装

root@cs1 local]# cd pgsql

8.1安装过程的第一步就是为你的系统配置源代码树并选择你喜欢的选项。这个工作是通过运行configure脚本实现的,对于默认安装,你只需要简单地输入:

[root@cs1 pgsql]# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking which template to use... linux
checking whether to build with 64-bit integer date/time support... yes
checking whether NLS is wanted... no
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for WAL segment size... 16MB
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc supports -Wdeclaration-after-statement... yes
checking whether gcc supports -Wendif-labels... yes
checking whether gcc supports -Wmissing-format-attribute... yes
checking whether gcc supports -Wformat-security... yes
checking whether gcc supports -fno-strict-aliasing... yes
checking whether gcc supports -fwrapv... yes
checking whether gcc supports -fexcess-precision=standard... yes
checking whether gcc supports -funroll-loops... yes
checking whether gcc supports -ftree-vectorize... yes
checking whether gcc supports -Wunused-command-line-argument... no
checking whether the C compiler still works... yes
checking how to run the C preprocessor... gcc -E
checking allow thread-safe client libraries... yes
checking whether to build with Tcl... no
checking whether to build Perl modules... no
checking whether to build Python modules... no
checking whether to build with GSSAPI support... no
checking whether to build with PAM support... no
checking whether to build with BSD Authentication support... no
checking whether to build with LDAP support... no
checking whether to build with Bonjour support... no
checking whether to build with OpenSSL support... no
checking whether to build with SELinux support... no
checking whether to build with systemd support... no
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for ranlib... ranlib
checking for strip... strip
checking whether it is possible to strip libraries... yes
checking for ar... ar
checking for a BSD-compatible install... /usr/bin/install -c
checking for tar... /usr/bin/tar
checking whether ln -s works... yes
checking for gawk... gawk
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for bison... /usr/bin/bison
configure: using bison (GNU Bison) 2.7
checking for flex... /usr/bin/flex
configure: using flex 2.5.37
checking for perl... /usr/bin/perl
configure: using perl 5.16.3
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking if compiler needs certain flags to reject unknown flags... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for strerror_r... yes
checking for getpwuid_r... yes
checking for gethostbyname_r... yes
checking whether strerror_r returns int... no
checking for main in -lm... yes
checking for library containing setproctitle... no
checking for library containing dlopen... -ldl
checking for library containing socket... none required
checking for library containing shl_load... no
checking for library containing getopt_long... none required
checking for library containing crypt... -lcrypt
checking for library containing shm_open... -lrt
checking for library containing shm_unlink... none required
checking for library containing fdatasync... none required
checking for library containing sched_yield... none required
checking for library containing gethostbyname_r... none required
checking for library containing shmget... none required
checking for library containing readline... -lreadline
checking for inflate in -lz... yes
checking atomic.h usability... no
checking atomic.h presence... no
checking for atomic.h... no
checking crypt.h usability... yes
checking crypt.h presence... yes
checking for crypt.h... yes
checking dld.h usability... no
checking dld.h presence... no
checking for dld.h... no
checking fp_class.h usability... no
checking fp_class.h presence... no
checking for fp_class.h... no
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking ieeefp.h usability... no
checking ieeefp.h presence... no
checking for ieeefp.h... no
checking ifaddrs.h usability... yes
checking ifaddrs.h presence... yes
checking for ifaddrs.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking mbarrier.h usability... no
checking mbarrier.h presence... no
checking for mbarrier.h... no
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking sys/pstat.h usability... no
checking sys/pstat.h presence... no
checking for sys/pstat.h... no
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/sem.h usability... yes
checking sys/sem.h presence... yes
checking for sys/sem.h... yes
checking sys/shm.h usability... yes
checking sys/shm.h presence... yes
checking for sys/shm.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/sockio.h usability... no
checking sys/sockio.h presence... no
checking for sys/sockio.h... no
checking sys/tas.h usability... no
checking sys/tas.h presence... no
checking for sys/tas.h... no
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking ucred.h usability... no
checking ucred.h presence... no
checking for ucred.h... no
checking utime.h usability... yes
checking utime.h presence... yes
checking for utime.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking wctype.h usability... yes
checking wctype.h presence... yes
checking for wctype.h... yes
checking for net/if.h... yes
checking for sys/ucred.h... no
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for netinet/tcp.h... yes
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking whether byte ordering is bigendian... no
checking for inline... inline
checking for printf format archetype... gnu_printf
checking for flexible array members... yes
checking for signed types... yes
checking for __func__... yes
checking for _Static_assert... yes
checking for __builtin_types_compatible_p... yes
checking for __builtin_bswap32... yes
checking for __builtin_bswap64... yes
checking for __builtin_constant_p... yes
checking for __builtin_unreachable... yes
checking for __VA_ARGS__... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct tm.tm_zone... yes
checking for tzname... yes
checking for union semun... no
checking for struct sockaddr_un... yes
checking for struct sockaddr_storage... yes
checking for struct sockaddr_storage.ss_family... yes
checking for struct sockaddr_storage.__ss_family... no
checking for struct sockaddr_storage.ss_len... no
checking for struct sockaddr_storage.__ss_len... no
checking for struct sockaddr.sa_len... no
checking for struct addrinfo... yes
checking for intptr_t... yes
checking for uintptr_t... yes
checking for unsigned long long int... yes
checking for long long int... yes
checking for locale_t... yes
checking for struct cmsgcred... no
checking for struct option... yes
checking for z_streamp... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking size of off_t... 8
checking for int timezone... yes
checking types of arguments for accept()... int, int, struct sockaddr *, socklen_t *
checking whether gettimeofday takes only one argument... no
checking for wcstombs_l declaration... no
checking for cbrt... yes
checking for dlopen... yes
checking for fdatasync... yes
checking for getifaddrs... yes
checking for getpeerucred... no
checking for getrlimit... yes
checking for mbstowcs_l... no
checking for memmove... yes
checking for poll... yes
checking for posix_fallocate... yes
checking for pstat... no
checking for pthread_is_threaded_np... no
checking for readlink... yes
checking for setproctitle... no
checking for setsid... yes
checking for shm_open... yes
checking for symlink... yes
checking for sync_file_range... yes
checking for towlower... yes
checking for utime... yes
checking for utimes... yes
checking for wcstombs... yes
checking for wcstombs_l... no
checking for fseeko... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for posix_fadvise... yes
checking whether posix_fadvise is declared... yes
checking whether fdatasync is declared... yes
checking whether strlcat is declared... no
checking whether strlcpy is declared... no
checking whether F_FULLFSYNC is declared... no
checking for struct sockaddr_in6... yes
checking for PS_STRINGS... no
checking for snprintf... yes
checking for vsnprintf... yes
checking whether snprintf is declared... yes
checking whether vsnprintf is declared... yes
checking for isinf... yes
checking for crypt... yes
checking for fls... no
checking for getopt... yes
checking for getrusage... yes
checking for inet_aton... yes
checking for mkdtemp... yes
checking for random... yes
checking for rint... yes
checking for srandom... yes
checking for strerror... yes
checking for strlcat... no
checking for strlcpy... no
checking for unsetenv... yes
checking for getpeereid... no
checking for getaddrinfo... yes
checking for getopt_long... yes
checking whether sys_siglist is declared... yes
checking for syslog... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for opterr... yes
checking for optreset... no
checking for strtoll... yes
checking for strtoull... yes
checking for rl_completion_append_character... yes
checking for rl_completion_matches... yes
checking for rl_filename_completion_function... yes
checking for rl_reset_screen_size... yes
checking for append_history... yes
checking for history_truncate_file... yes
checking test program... ok
checking whether long int is 64 bits... yes
checking whether snprintf supports the %z modifier... yes
checking size of void *... 8
checking size of size_t... 8
checking size of long... 8
checking whether to build with float4 passed by value... yes
checking whether to build with float8 passed by value... yes
checking alignment of short... 2
checking alignment of int... 4
checking alignment of long... 8
checking alignment of double... 8
checking for int8... no
checking for uint8... no
checking for int64... no
checking for uint64... no
checking for __int128... yes
checking for builtin __sync char locking functions... yes
checking for builtin __sync int32 locking functions... yes
checking for builtin __sync int32 atomic operations... yes
checking for builtin __sync int64 atomic operations... yes
checking for builtin __atomic int32 atomic operations... yes
checking for builtin __atomic int64 atomic operations... yes
checking for __get_cpuid... yes
checking for __cpuid... no
checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=... no
checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=-msse4.2... yes
checking which CRC-32C implementation to use... SSE 4.2 with runtime check
checking for onsgmls... no
checking for nsgmls... no
checking for openjade... no
checking for jade... no
checking for DocBook V4.2... no
checking for DocBook stylesheets... no
checking for collateindex.pl... no
checking for dbtoepub... no
checking for xmllint... xmllint
checking for xsltproc... xsltproc
checking for osx... no
checking for sgml2xml... no
checking for sx... sx
checking thread safety of required library functions... yes
checking whether gcc supports -Wl,--as-needed... yes
configure: using compiler=gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9)
configure: using CFLAGS=-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2
configure: using CPPFLAGS= -D_GNU_SOURCE 
configure: using LDFLAGS=  -Wl,--as-needed
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/include/pg_config_ext.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking src/backend/port/dynloader/linux.c to src/backend/port/dynloader.c
config.status: linking src/backend/port/sysv_sema.c to src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking src/backend/port/dynloader/linux.h to src/include/dynloader.h
config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port

默认安装目录/usr/local/pgsql,可以使用–prefix=path进行修改,./configure –help

8.2 编译
要开始编译,键入:

root@cs1 local]# make

(一定要记得用GNU make)。依你的硬件而异,编译过程可能需要 5 分钟到半小时。显示的最后一行应该是:

All of PostgreSQL successfully made. Ready to install.

如果你希望编译所有能编译的东西,包括文档(HTML和手册页)以及附加模块(contrib),这样键入:

[root@cs1 pgsql]# make world
.....省略.....
make[2]: 离开目录“/usr/local/postgresql-9.6.6/contrib/vacuumlo”
make[1]: 离开目录“/usr/local/postgresql-9.6.6/contrib”
PostgreSQL, contrib, and documentation successfully made. Ready to install.

8.3安装文件
要安装PostgreSQL,输入:

make install

这条命令将把文件安装到在步骤 1中指定的目录。确保你有足够的权限向该区域写入。通常你需要用 root 权限做这一步。或者你也可以事先创建目标目录并且分派合适的权限。

要安装文档(HTML和手册页),输入:

make install-docs

如果你按照上面的方法编译了所有东西,输入:

make install-world

这也会安装文档。

[root@cs1 pgsql]# make install-world
......省略....
make[2]: 离开目录“/usr/local/postgresql-9.6.6/contrib/vacuumlo”
make[1]: 离开目录“/usr/local/postgresql-9.6.6/contrib”
PostgreSQL, contrib, and documentation installation complete.

9.设置环境变量
创建目录/usr/local/pgsql/data用来存放数据

[root@cs1 pgsql]# mkdir /usr/local/pgsql/data
[root@cs1 pgsql]# chown pgsql:pgsql data

[root@cs1 pgsql]# su - pgsql
[pgsql@cs1 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
export LD_LIBRARY_PATH=/usr/local/pgsql/lib
export PG_HOME=/usr/local/pgsql
export PATH=$PG_HOME/bin/:$PATH
export PGDATA=/usr/local/pgsql/data

10.初始化数据库
使用pgsql用户来执行

[pgsql@cs1 ~]$ initdb --help
initdb initializes a PostgreSQL database cluster.

Usage:
  initdb [OPTION]... [DATADIR]

Options:
  -A, --auth=METHOD         default authentication method for local connections
      --auth-host=METHOD    default authentication method for local TCP/IP connections
      --auth-local=METHOD   default authentication method for local-socket connections
 [-D, --pgdata=]DATADIR     location for this database cluster
  -E, --encoding=ENCODING   set default encoding for new databases
      --locale=LOCALE       set default locale for new databases
      --lc-collate=, --lc-ctype=, --lc-messages=LOCALE
      --lc-monetary=, --lc-numeric=, --lc-time=LOCALE
                            set default locale in the respective category for
                            new databases (default taken from environment)
      --no-locale           equivalent to --locale=C
      --pwfile=FILE         read password for the new superuser from file
  -T, --text-search-config=CFG
                            default text search configuration
  -U, --username=NAME       database superuser name
  -W, --pwprompt            prompt for a password for the new superuser
  -X, --xlogdir=XLOGDIR     location for the transaction log directory

Less commonly used options:
  -d, --debug               generate lots of debugging output
  -k, --data-checksums      use data page checksums
  -L DIRECTORY              where to find the input files
  -n, --noclean             do not clean up after errors
  -N, --nosync              do not wait for changes to be written safely to disk
  -s, --show                show internal settings
  -S, --sync-only           only sync data directory

Other options:
  -V, --version             output version information, then exit
  -?, --help                show this help, then exit

If the data directory is not specified, the environment variable PGDATA
is used.

Report bugs to .
[pgsql@cs1 ~]$ initdb -D /usr/local/pgsql/data
The files belonging to this database system will be owned by user "pgsql".
This user must also own the server process.

The database cluster will be initialized with locale "zh_CN.gb2312".
The default database encoding has accordingly been set to "EUC_CN".
initdb: could not find suitable text search configuration for locale "zh_CN.gb2312"
The default text search configuration will be set to "simple".

Data page checksums are disabled.

fixing permissions on existing directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /usr/local/pgsql/data -l logfile start

同时在pgsql的目录可以看到生成的数据目录data以及该目录的相关数据和配置文件:

[root@cs1 soft]# cd /usr/local/pgsql
[root@cs1 pgsql]# ls -lrt
总用量 1080
-rw-r--r--  1 pgsql pgsql   1212 11月  7 2017 README
-rw-r--r--  1 pgsql pgsql   1529 11月  7 2017 Makefile
-rw-r--r--  1 pgsql pgsql    284 11月  7 2017 HISTORY
-rw-r--r--  1 pgsql pgsql   3638 11月  7 2017 GNUmakefile.in
-rw-r--r--  1 pgsql pgsql   1192 11月  7 2017 COPYRIGHT
-rw-r--r--  1 pgsql pgsql  74867 11月  7 2017 configure.in
-rwxr-xr-x  1 pgsql pgsql 471555 11月  7 2017 configure
-rw-r--r--  1 pgsql pgsql    384 11月  7 2017 aclocal.m4
drwxrwxrwx 55 pgsql pgsql   4096 11月  7 2017 contrib
drwxrwxrwx  2 pgsql pgsql   4096 11月  7 2017 config
drwxrwxrwx  3 pgsql pgsql    101 11月  7 2017 doc
-rw-r--r--  1 pgsql pgsql  76016 11月  7 2017 INSTALL
-rwxr-xr-x  1 root  root   39264 6月   4 21:29 config.status
-rw-r--r--  1 root  root    3638 6月   4 21:29 GNUmakefile
drwxrwxrwx 16 pgsql pgsql   4096 6月   4 21:29 src
-rw-r--r--  1 root  root  370213 6月   4 21:29 config.log
drwxr-xr-x  4 root  root      26 6月   4 21:43 tmp_install
drwxr-xr-x  6 root  root    4096 6月   4 21:45 include
drwxr-xr-x  8 root  root    4096 6月   4 21:45 share
drwxr-xr-x  4 root  root    4096 6月   4 21:45 lib
drwxr-xr-x  2 root  root    4096 6月   4 21:45 bin
drwx------ 19 pgsql pgsql   4096 6月   4 21:56 data
[root@cs1 pgsql]# cd data
[root@cs1 data]# ls -lrt
总用量 48
drwx------ 2 pgsql pgsql     6 6月   4 21:56 pg_twophase
drwx------ 2 pgsql pgsql     6 6月   4 21:56 pg_snapshots
drwx------ 2 pgsql pgsql     6 6月   4 21:56 pg_serial
drwx------ 2 pgsql pgsql     6 6月   4 21:56 pg_replslot
drwx------ 4 pgsql pgsql    34 6月   4 21:56 pg_multixact
drwx------ 2 pgsql pgsql     6 6月   4 21:56 pg_dynshmem
drwx------ 2 pgsql pgsql     6 6月   4 21:56 pg_commit_ts
-rw------- 1 pgsql pgsql     4 6月   4 21:56 PG_VERSION
drwx------ 2 pgsql pgsql     6 6月   4 21:56 pg_tblspc
drwx------ 2 pgsql pgsql     6 6月   4 21:56 pg_stat_tmp
drwx------ 2 pgsql pgsql     6 6月   4 21:56 pg_stat
drwx------ 4 pgsql pgsql    37 6月   4 21:56 pg_logical
-rw------- 1 pgsql pgsql 22304 6月   4 21:56 postgresql.conf
-rw------- 1 pgsql pgsql    88 6月   4 21:56 postgresql.auto.conf
-rw------- 1 pgsql pgsql  1636 6月   4 21:56 pg_ident.conf
-rw------- 1 pgsql pgsql  4459 6月   4 21:56 pg_hba.conf
drwx------ 3 pgsql pgsql    58 6月   4 21:56 pg_xlog
drwx------ 2 pgsql pgsql    17 6月   4 21:56 pg_subtrans
drwx------ 2 pgsql pgsql    17 6月   4 21:56 pg_clog
drwx------ 2 pgsql pgsql    17 6月   4 21:56 pg_notify
drwx------ 2 pgsql pgsql  4096 6月   4 21:56 global
drwx------ 5 pgsql pgsql    38 6月   4 21:56 base

11.启动数据库
在初始化数据库结束后看到了启动命令:

Success. You can now start the database server using:

    pg_ctl -D /usr/local/pgsql/data -l logfile start
[pgsql@cs1 ~]$ echo $PGDATA
/usr/local/pgsql/data

由于我们设置了环境变量,所以已经指定了数据目录PGDATA, -l表示日志文件目录,通常需要指定,所以我们在/usr/local/pgsql根目录下再创建一个log目录用来存放日志文件(注意别忘记赋予可写的权限)

[root@cs1 pgsql]# chown -R pgsql:pgsql log
[root@cs1 pgsql]# chmod -R 775 log
[root@cs1 pgsql]# ls -lrt
总用量 1080
-rw-r--r--  1 pgsql pgsql   1212 11月  7 2017 README
-rw-r--r--  1 pgsql pgsql   1529 11月  7 2017 Makefile
-rw-r--r--  1 pgsql pgsql    284 11月  7 2017 HISTORY
-rw-r--r--  1 pgsql pgsql   3638 11月  7 2017 GNUmakefile.in
-rw-r--r--  1 pgsql pgsql   1192 11月  7 2017 COPYRIGHT
-rw-r--r--  1 pgsql pgsql  74867 11月  7 2017 configure.in
-rwxr-xr-x  1 pgsql pgsql 471555 11月  7 2017 configure
-rw-r--r--  1 pgsql pgsql    384 11月  7 2017 aclocal.m4
drwxrwxrwx 55 pgsql pgsql   4096 11月  7 2017 contrib
drwxrwxrwx  2 pgsql pgsql   4096 11月  7 2017 config
drwxrwxrwx  3 pgsql pgsql    101 11月  7 2017 doc
-rw-r--r--  1 pgsql pgsql  76016 11月  7 2017 INSTALL
-rwxr-xr-x  1 root  root   39264 6月   4 21:29 config.status
-rw-r--r--  1 root  root    3638 6月   4 21:29 GNUmakefile
drwxrwxrwx 16 pgsql pgsql   4096 6月   4 21:29 src
-rw-r--r--  1 root  root  370213 6月   4 21:29 config.log
drwxr-xr-x  4 root  root      26 6月   4 21:43 tmp_install
drwxr-xr-x  6 root  root    4096 6月   4 21:45 include
drwxr-xr-x  8 root  root    4096 6月   4 21:45 share
drwxr-xr-x  4 root  root    4096 6月   4 21:45 lib
drwxr-xr-x  2 root  root    4096 6月   4 21:45 bin
drwx------ 19 pgsql pgsql   4096 6月   4 21:56 data
drwxrwxr-x  2 pgsql pgsql      6 6月   4 22:04 log

运行pg_ctl start -l /usr/local/pgsql/log/pg_server.log即可启动数据库

[pgsql@cs1 ~]$ pg_ctl start -l /usr/local/pgsql/log/pg_server.log
server starting

通过ps -ef|grep postgres查看一下postgres相关是否存在相关进程

[root@cs1 log]# ps -ef|grep postgres
pgsql     4977     1  0 22:05 pts/3    00:00:00 /usr/local/postgresql-9.6.6/bin/postgres
pgsql     4980  4977  0 22:05 ?        00:00:00 postgres: checkpointer process   
pgsql     4981  4977  0 22:05 ?        00:00:00 postgres: writer process   
pgsql     4982  4977  0 22:05 ?        00:00:00 postgres: wal writer process   
pgsql     4983  4977  0 22:05 ?        00:00:00 postgres: autovacuum launcher process   
pgsql     4984  4977  0 22:05 ?        00:00:00 postgres: stats collector process   
root      5145 15622  0 22:06 pts/4    00:00:00 grep --color=auto postgres

从数据库日志文件可以看到如下信息:

[root@cs1 log]# tail -f pg_server.log 
LOG:  database system was shut down at 2019-06-04 21:56:12 CST
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

12.连接数据库

[pgsql@cs1 ~]$ psql --list
                               List of databases
   Name    | Owner | Encoding |   Collate    |    Ctype     | Access privileges 
-----------+-------+----------+--------------+--------------+-------------------
 postgres  | pgsql | EUC_CN   | zh_CN.gb2312 | zh_CN.gb2312 | 
 template0 | pgsql | EUC_CN   | zh_CN.gb2312 | zh_CN.gb2312 | =c/pgsql         +
           |       |          |              |              | pgsql=CTc/pgsql
 template1 | pgsql | EUC_CN   | zh_CN.gb2312 | zh_CN.gb2312 | =c/pgsql         +
           |       |          |              |              | pgsql=CTc/pgsql
(3 rows)

启动成功后我们就可以通过postgresql自带的客户端工具psql来进行连接,直接输入psql看到版本信息则说明连接成功:

[pgsql@cs1 ~]$ psql postgres
psql (9.6.6)
Type "help" for help.

postgres=# 

接下来要做的第一件事就是设置postgres用户的密码(默认为空),用psql连接成功后直接输入\password即会提示输入两次密码

[pgsql@cs1 ~]$ psql postgres
psql (9.6.6)
Type "help" for help.

postgres=# \password
Enter new password: 
Enter it again: 
postgres=# \l
                               List of databases
   Name    | Owner | Encoding |   Collate    |    Ctype     | Access privileges 
-----------+-------+----------+--------------+--------------+-------------------
 postgres  | pgsql | EUC_CN   | zh_CN.gb2312 | zh_CN.gb2312 | 
 template0 | pgsql | EUC_CN   | zh_CN.gb2312 | zh_CN.gb2312 | =c/pgsql         +
           |       |          |              |              | pgsql=CTc/pgsql
 template1 | pgsql | EUC_CN   | zh_CN.gb2312 | zh_CN.gb2312 | =c/pgsql         +
           |       |          |              |              | pgsql=CTc/pgsql
(3 rows)


postgres=# \l
                               List of databases
   Name    | Owner | Encoding |   Collate    |    Ctype     | Access privileges 
-----------+-------+----------+--------------+--------------+-------------------
 postgres  | pgsql | EUC_CN   | zh_CN.gb2312 | zh_CN.gb2312 | 
 template0 | pgsql | EUC_CN   | zh_CN.gb2312 | zh_CN.gb2312 | =c/pgsql         +
           |       |          |              |              | pgsql=CTc/pgsql
 template1 | pgsql | EUC_CN   | zh_CN.gb2312 | zh_CN.gb2312 | =c/pgsql         +
           |       |          |              |              | pgsql=CTc/pgsql
(3 rows)

postgres=# select version();
                                                 version                                                 
---------------------------------------------------------------------------------------------------------
 PostgreSQL 9.6.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9), 64-bit
(1 row)

postgres=# select current_date;
    date    
------------
 2019-06-04
(1 row)

postgres=# 

到此使用源码来安装pg数据库就完成了。

Oracle Linux 7.1中安装MariaDB

在Oracle Linux 7.1中安装Mariadb 10.0.38,因为Mariadb是Mysql的分支,安装操作基本类似。
1.首先下载安装介质mariadb-10.0.38-linux-glibc_214-x86_64.tar.gz 并将其上传到服务器的/soft目录

2.创建用户与用户组

[root@cs1 soft]# groupadd mysql

[root@cs1 soft]# useradd -g mysql mysql

3.将介质解压到/usr/local/目录下

[root@cs1 soft]# cd /usr/local

[root@cs1 local]# gunzip < /soft/mariadb-10.0.38-linux-glibc_214-x86_64.tar.gz | tar xvf -
mariadb-10.0.38-linux-glibc_214-x86_64/
mariadb-10.0.38-linux-glibc_214-x86_64/man/
mariadb-10.0.38-linux-glibc_214-x86_64/man/man8/
mariadb-10.0.38-linux-glibc_214-x86_64/man/man8/mysqld.8
........省略..........

[root@cs1 local]# ls -lrt
总用量 4
drwxr-xr-x.  2 root root    6 5月   8 2014 src
drwxr-xr-x.  2 root root    6 5月   8 2014 sbin
drwxr-xr-x.  2 root root    6 5月   8 2014 libexec
drwxr-xr-x.  2 root root    6 5月   8 2014 lib64
drwxr-xr-x.  2 root root    6 5月   8 2014 lib
drwxr-xr-x.  2 root root    6 5月   8 2014 include
drwxr-xr-x.  2 root root    6 5月   8 2014 games
drwxr-xr-x.  2 root root    6 5月   8 2014 etc
drwxr-xr-x.  5 root root   46 10月 12 2017 share
drwxr-xr-x.  2 root root   46 3月   9 2018 bin
drwxrwxr-x  13 1021 1004 4096 1月  31 02:40 mariadb-10.0.38-linux-glibc_214-x86_64

4.创建软链接

[root@cs1 local]# ln -s mariadb-10.0.38-linux-glibc_214-x86_64 mysql
[root@cs1 local]# ls -lrt
总用量 4
drwxr-xr-x.  2 root root    6 5月   8 2014 src
drwxr-xr-x.  2 root root    6 5月   8 2014 sbin
drwxr-xr-x.  2 root root    6 5月   8 2014 libexec
drwxr-xr-x.  2 root root    6 5月   8 2014 lib64
drwxr-xr-x.  2 root root    6 5月   8 2014 lib
drwxr-xr-x.  2 root root    6 5月   8 2014 include
drwxr-xr-x.  2 root root    6 5月   8 2014 games
drwxr-xr-x.  2 root root    6 5月   8 2014 etc
drwxr-xr-x.  5 root root   46 10月 12 2017 share
drwxr-xr-x.  2 root root   46 3月   9 2018 bin
drwxrwxr-x  13 1021 1004 4096 1月  31 02:40 mariadb-10.0.38-linux-glibc_214-x86_64
lrwxrwxrwx   1 root root   38 6月   4 14:43 mysql -> mariadb-10.0.38-linux-glibc_214-x86_64

5.确保目录mysql能够被用户mysql访问

[root@cs1 local]# cd mysql
[root@cs1 mysql]# chown -R mysql .
[root@cs1 mysql]# chgrp -R mysql .

6.在安装Mariadb之前,必须创建Mariadb存放数据的目录并初始化grant表,执行mysql_install_db命令来安装Mariadb,如果使用root用户来执行,必须包含–user选项来指定用户,如果是mysql用户来执行可以忽略–user选项。使用 –basedir=path 选项指定Mariadb安装目录的路径,–datadir=path选项指定Mariadb数据目录的路径。如果没有指定–basedir与–datadir选项它们在/usr/local/mysql目录下创建一个data目录。

[root@cs1 mysql]# scripts/mysql_install_db --user=mysql
Installing MariaDB/MySQL system tables in './data' ...
190604 14:44:44 [Note] ./bin/mysqld (mysqld 10.0.38-MariaDB) starting as process 19627 ...
190604 14:44:45 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

190604 14:44:45 [Note] InnoDB: Using mutexes to ref count buffer pool pages
190604 14:44:45 [Note] InnoDB: The InnoDB memory heap is disabled
190604 14:44:45 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
190604 14:44:45 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
190604 14:44:45 [Note] InnoDB: Compressed tables use zlib 1.2.11
190604 14:44:45 [Note] InnoDB: Using Linux native AIO
190604 14:44:45 [Note] InnoDB: Using CPU crc32 instructions
190604 14:44:45 [Note] InnoDB: Initializing buffer pool, size = 128.0M
190604 14:44:45 [Note] InnoDB: Completed initialization of buffer pool
190604 14:44:45 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
190604 14:44:45 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
190604 14:44:45 [Note] InnoDB: Database physically writes the file full: wait...
190604 14:44:45 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
190604 14:44:45 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
190604 14:44:46 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
190604 14:44:46 [Warning] InnoDB: New log files created, LSN=45781
190604 14:44:46 [Note] InnoDB: Doublewrite buffer not found: creating new
190604 14:44:46 [Note] InnoDB: Doublewrite buffer created
190604 14:44:46 [Note] InnoDB: 128 rollback segment(s) are active.
190604 14:44:46 [Warning] InnoDB: Creating foreign key constraint system tables.
190604 14:44:46 [Note] InnoDB: Foreign key constraint system tables created
190604 14:44:46 [Note] InnoDB: Creating tablespace and datafile system tables.
190604 14:44:46 [Note] InnoDB: Tablespace and datafile system tables created.
190604 14:44:46 [Note] InnoDB: Waiting for purge to start
190604 14:44:46 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.42-84.2 started; log sequence number 0
190604 14:44:48 [Note] InnoDB: FTS optimize thread exiting.
190604 14:44:48 [Note] InnoDB: Starting shutdown...
190604 14:44:48 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
190604 14:44:50 [Note] InnoDB: Shutdown completed; log sequence number 1616697
OK
Filling help tables...
190604 14:44:50 [Note] ./bin/mysqld (mysqld 10.0.38-MariaDB) starting as process 19661 ...
190604 14:44:50 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

190604 14:44:50 [Note] InnoDB: Using mutexes to ref count buffer pool pages
190604 14:44:50 [Note] InnoDB: The InnoDB memory heap is disabled
190604 14:44:50 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
190604 14:44:50 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
190604 14:44:50 [Note] InnoDB: Compressed tables use zlib 1.2.11
190604 14:44:50 [Note] InnoDB: Using Linux native AIO
190604 14:44:50 [Note] InnoDB: Using CPU crc32 instructions
190604 14:44:50 [Note] InnoDB: Initializing buffer pool, size = 128.0M
190604 14:44:50 [Note] InnoDB: Completed initialization of buffer pool
190604 14:44:50 [Note] InnoDB: Highest supported file format is Barracuda.
190604 14:44:50 [Note] InnoDB: 128 rollback segment(s) are active.
190604 14:44:50 [Note] InnoDB: Waiting for purge to start
190604 14:44:50 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.42-84.2 started; log sequence number 1616697
190604 14:44:50 [Note] InnoDB: FTS optimize thread exiting.
190604 14:44:50 [Note] InnoDB: Starting shutdown...
190604 14:44:51 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
190604 14:44:53 [Note] InnoDB: Shutdown completed; log sequence number 1616707
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'./bin/mysqladmin' -u root password 'new-password'
'./bin/mysqladmin' -u root -h cs1.jy.net password 'new-password'

Alternatively you can run:
'./bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '.' ; ./bin/mysqld_safe --datadir='./data'

You can test the MariaDB daemon with mysql-test-run.pl
cd './mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
Get Involved

7.因为安装Mariadb的用户是root用户,而data目录必须要被mysql用户访问,因此修改data目录的用户与组权限

[root@cs1 mysql]# chown -R root .
[root@cs1 mysql]# chown -R mysql data

8.在安装完成后来测试Mariadb的启动

[root@cs1 mysql]# bin/mysqld_safe --user=mysql &
[1] 19770
[root@cs1 mysql]# 190604 14:45:25 mysqld_safe Logging to '/usr/local/mysql/data/cs1.jy.net.err'.
190604 14:45:25 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

mysqld_safe是服务端工具,用于启动mysqld,并且是mysqld的守护进程,mysqld_safe加&在后台运行$BASEDIR/bin/mysqld_safe &。因为mysqld_safe是mysqld的守护进程,所以mysqld_safe脚本会在启动MySQL服务器后继续监控其运行情况,并在其死机时重新启动它。直接使用mysqld_safe启动mysqld时,mysqld_safe可以使用参数选项见mysqld_safe –help,此时可以使用其他配置文件,相当于mysqld_safe把参数传递给mysqld。mysql.server脚本其实也是调用mysqld_safe脚本去启动MySQL服务器的,但此时mysqld_safe不能使用参数选项即不能mysqld_safe –defaults-file这样的模式。

9.将启动Mariadb的脚本配置成服务通过service name start命令来启用

[root@cs1 mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@cs1 mysql]# cat /etc/init.d/mysqld

[root@cs1 Packages]# service mysqld status
 SUCCESS! MariaDB running (19839)
[root@cs1 Packages]# service mysqld stop
Shutting down MariaDB... SUCCESS! 
[root@cs1 Packages]# service mysqld start
Starting MariaDB.190604 18:26:04 mysqld_safe Logging to '/usr/local/mysql/data/cs1.jy.net.err'.
190604 18:26:05 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
 SUCCESS! 

10.修改root用户密码

-bash-4.2$ mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.0.38-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 
MariaDB [mysql]> set password=password("123456");
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> exit

-bash-4.2$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 10.0.38-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.01 sec)

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

11.使用mytop工具来监控Mariadb,mytop在Mariadb安装时也会自动安装,而mysql中需要单独安装

-bash-4.2$ mytop --prompt -u root -d mysql
Password: 
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 13) line 3,  line 1.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
 at /usr/local/mysql//bin/mytop line 253.

错误信息说明没有安装perl-DBD-MySQL工具包

12.安装perl-DBD-MySQ工具包

[root@cs1 bin]# yum install perl-DBD-MySQL
已加载插件:langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
file:///run/media/jy/OL-7.1%20Server.x86_64/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /run/media/jy/OL-7.1%20Server.x86_64/repodata/repomd.xml"
正在尝试其它镜像。
正在解决依赖关系
--> 正在检查事务
---> 软件包 perl-DBD-MySQL.x86_64.0.4.023-5.0.1.el7 将被 安装
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 perl-DBD-MySQL-4.023-5.0.1.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 perl-DBD-MySQL-4.023-5.0.1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-libs.x86_64.0.5.6.23-3.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.6.23-3.el7,它被软件包 mysql-community-libs-5.6.23-3.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-common.x86_64.0.5.6.23-3.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

============================================================================================================================================================================================================================================
 Package                                                            架构                                               版本                                                         源                                                 大小
============================================================================================================================================================================================================================================
正在安装:
 perl-DBD-MySQL                                                     x86_64                                             4.023-5.0.1.el7                                              local                                             140 k
为依赖而安装:
 mysql-community-common                                             x86_64                                             5.6.23-3.el7                                                 local                                             256 k
 mysql-community-libs                                               x86_64                                             5.6.23-3.el7                                                 local                                             2.0 M

事务概要
============================================================================================================================================================================================================================================
安装  1 软件包 (+2 依赖软件包)

总下载量:2.4 M
安装大小:12 M
Is this ok [y/d/N]: y
Downloading packages:


Error downloading packages:
  mysql-community-common-5.6.23-3.el7.x86_64: [Errno 256] No more mirrors to try.
  perl-DBD-MySQL-4.023-5.0.1.el7.x86_64: [Errno 256] No more mirrors to try.
  mysql-community-libs-5.6.23-3.el7.x86_64: [Errno 256] No more mirrors to try.

出现不能下载相关工具包的错误

13.将操作系统ISO文件挂载到系统中并进入Packages目录执行rpm命令来安装

root@cs1 Packages]# ls -lrt mysql*
-rw-rw-r-- 1 root root  1313664 5月  14 2014 mysql-connector-java-5.1.25-3.el7.noarch.rpm
-rw-rw-r-- 1 root root   145144 8月   6 2014 mysql-connector-odbc-5.2.5-6.0.1.el7.x86_64.rpm
-rw-r--r-- 1 root root   420364 2月  19 2015 mysql-community-bench-5.6.23-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 19378376 2月  19 2015 mysql-community-client-5.6.23-3.el7.i686.rpm
-rw-r--r-- 1 root root  3435828 2月  19 2015 mysql-community-devel-5.6.23-3.el7.i686.rpm
-rw-r--r-- 1 root root   262464 2月  19 2015 mysql-community-common-5.6.23-3.el7.x86_64.rpm
-rw-r--r-- 1 root root   262516 2月  19 2015 mysql-community-common-5.6.23-3.el7.i686.rpm
-rw-r--r-- 1 root root 19979168 2月  19 2015 mysql-community-client-5.6.23-3.el7.x86_64.rpm
-rw-r--r-- 1 root root  3543424 2月  19 2015 mysql-community-devel-5.6.23-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 23060740 2月  19 2015 mysql-community-embedded-5.6.23-3.el7.i686.rpm
-rw-r--r-- 1 root root 23733580 2月  19 2015 mysql-community-embedded-5.6.23-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 64644916 2月  19 2015 mysql-community-embedded-devel-5.6.23-3.el7.i686.rpm
-rw-r--r-- 1 root root  2104968 2月  19 2015 mysql-community-libs-5.6.23-3.el7.x86_64.rpm
-rw-r--r-- 1 root root  2040356 2月  19 2015 mysql-community-libs-5.6.23-3.el7.i686.rpm
-rw-r--r-- 1 root root 68058508 2月  19 2015 mysql-community-embedded-devel-5.6.23-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 60224180 2月  19 2015 mysql-community-server-5.6.23-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 59280136 2月  19 2015 mysql-community-test-5.6.23-3.el7.x86_64.rpm

[root@cs1 Packages]# rpm -ihv mysql-community-libs-5.6.23-3.el7.x86_64.rpm
警告:mysql-community-libs-5.6.23-3.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
错误:依赖检测失败:
        mysql-community-common(x86-64) = 5.6.23-3.el7 被 mysql-community-libs-5.6.23-3.el7.x86_64 需要
[root@cs1 Packages]# rpm -ivh mysql-community-common-5.6.23-3.el7.x86_64.rpm
警告:mysql-community-common-5.6.23-3.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
准备中...                             ################################# [100%]
正在升级/安装...
   1:mysql-community-common-5.6.23-3.e################################# [100%]
[root@cs1 Packages]# rpm -ihv mysql-community-libs-5.6.23-3.el7.x86_64.rpm
警告:mysql-community-libs-5.6.23-3.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
准备中...                             ################################# [100%]
正在升级/安装...
   1:mysql-community-libs-5.6.23-3.el7################################# [100%]

[root@cs1 Packages]# ls -lrt perl-DBD-MySQL
ls: 无法访问perl-DBD-MySQL: 没有那个文件或目录
[root@cs1 Packages]# ls -lrt perl-DBD-MySQL*
-rw-rw-r-- 1 root root 143092 8月   6 2014 perl-DBD-MySQL-4.023-5.0.1.el7.x86_64.rpm
[root@cs1 Packages]# rpm -ivh perl-DBD-MySQL-4.023-5.0.1.el7.x86_64.rpm
警告:perl-DBD-MySQL-4.023-5.0.1.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
准备中...                             ################################# [100%]
正在升级/安装...
   1:perl-DBD-MySQL-4.023-5.0.1.el7   ################################# [100%]

14.执行mytop命令来监控Mariadb

-bash-4.2$ mytop -u root -p 123456
MariaDB on localhost (10.0.38-MariaDB)                                                                                                                                                                  up 0+01:04:21 [15:49:46]
 Queries: 170.0   qps:    0 Slow:     0.0         Se/In/Up/De(%):    06/00/00/00
 Sorts:     0 qps now:    1 Slow qps: 0.0  Threads:    2 (   1/   0) 00/00/00/00
 Handler: (R/W/U/D)     0/    0/    0/    0        Tmp: R/W/U:    89/   89/    0
 ISAM Key Efficiency: 0.0%  Bps in/out:   1.4/ 66.6   Now in/out:  22.6/ 2.9k

       Id     User         Host/IP        DB   Time     %    Cmd           State Query
       --     ----         -------        --   ----     -    ---           ----- ----------
       12     root       localhost     mysql     10   0.0  Sleep                                                                                                                                                                          
       10     root       localhost      test      0   0.0  Query            init show full processlist   

到此安装也就完成了。

Linux 7 安装Mysql 5.7

在Oracle Linux 7.1中安装MySql 5.7 。mysql安装位置:/mysqlsoft/mysql,数据库文件数据位置:/mysqldata/mysql。
1.首先下载安装介质

mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

2. 在根目录下创建文件夹mysqlsoft和数据库数据文件/mysqldata/mysql

[root@cs2 /]# mkdir -p /mysqlsoft
[root@cs2 /]# mkdir -p /mysqldata/mysql
[root@cs2 /]# ls -lrt /mysqldata/
total 0
drwxr-xr-x 2 root root 6 May 31 11:58 mysql

3.上传介质mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz到/mysqlsoft目录中并解压

[root@cs2 /]# cd mysqlsoft
[root@cs2 mysqlsoft]# ls -lrt
total 628704
-rw-r--r-- 1 root root 643790848 Apr 20  2018 mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

[root@cs2 mysqlsoft]# tar -zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

[root@cs2 mysqlsoft]# ls -lrt
total 628704
-rw-r--r-- 1 root root 643790848 Apr 20  2018 mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
drwxr-xr-x 9 root root       120 May 31 12:11 mysql-5.7.22-linux-glibc2.12-x86_64

建议一般不要修改默认文件名,通过软连接来完成

[root@cs2 mysqlsoft]# mv mysql-5.7.22-linux-glibc2.12-x86_64  mysql

[root@cs2 mysqlsoft]# ls -lrt
total 628704
-rw-r--r-- 1 root root 643790848 Apr 20  2018 mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
drwxr-xr-x 9 root root       120 May 31 13:28 mysql-5.7.22-linux-glibc2.12-x86_64
lrwxrwxrwx 1 root root        35 May 31 13:33 mysql -> mysql-5.7.22-linux-glibc2.12-x86_64
[root@cs2 mysqlsoft]# cd mysql
[root@cs2 mysql]# ls
bin  COPYING  docs  include  lib  man  README  share  support-files

4. 创建mysql用户与用户组

[root@cs2 mysql]# groupadd mysql
[root@cs2 mysql]# useradd -r -g mysql -s /bin/false mysql

因为用户只用于所有权目的,而不是登录目的,useradd命令使用-r与-s /bin/false选项来创建一个用户没有登录服务器主机的权限。

5.修改/mysqlsoft/mysql与/mysqldata/mysql目录权限

[root@cs2 /]# chown -R mysql:mysql /mysqlsoft/mysql
[root@cs2 /]# chown -R mysql:mysql /mysqldata/mysql
[root@cs2 /]# chmod -R 775 /mysqlsoft/mysql
[root@cs2 /]# chmod -R 775 /mysqldata/mysql

6. MySQL对于libaio库有依赖性。台果这个libaio库没有安装那么数据目录初始化与后续的数据库服务启动将会失败,安装libaio库执行以下操作:
查询是否安装了libaio库

[root@cs2 local]# yum search libaio
Loaded plugins: langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
=========================================================================================================== N/S matched: libaio ============================================================================================================
libaio.i686 : Linux-native asynchronous I/O access library
libaio.x86_64 : Linux-native asynchronous I/O access library
libaio-devel.i686 : Development files for Linux-native asynchronous I/O access
libaio-devel.x86_64 : Development files for Linux-native asynchronous I/O access

  Name and summary matches only, use "search all" for everything.

如果没有安装,可以执行下面的命令来安装

[root@cs2 local]# yum install libaio
Loaded plugins: langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
file:///run/media/jy/OL-7.1%20Server.x86_64/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /run/media/jy/OL-7.1%20Server.x86_64/repodata/repomd.xml"
Trying other mirror.
Package libaio-0.3.109-12.el7.x86_64 already installed and latest version
Nothing to do

7.配置mysql参数
只是设置几个简单的mysql运行参数

[root@cs2 ~]# vi /mysqlsoft/mysql/my.cnf 
[mysqld]
basedir=/mysqlsoft/mysql
datadir=/mysqldata/mysql
bind-address=0.0.0.0
user=mysql
port=3306
log-error=/mysqldata/mysql/mysql.err
pid-file=/mysqldata/mysql/mysqld.pid
socket = /mysqldata/mysql/mysql.sock
character-set-server=utf8
default-storage-engine=INNODB
explicit_defaults_for_timestamp = true
"/mysqlsoft/mysql/my.cnf" [New] 67L, 1642C written

注意:log-error 一定要配置,因为如果mysql启动错误,可以从日志文件中找到错误原因。其次bind—address配置0.0.0.0是为了监听所有的连接。还有就是socket参数所指定的mysql.sock文件的路径最好设置为/tmp/mysql.sock,因为unix socket文件的缺省位置在/tmp目录中。

8.初始化mysql

[root@cs2 /]# cd /mysqlsoft/mysql/bin
[root@cs2 bin]# ./mysqld --user=mysql  --defaults-file=/mysqlsoft/mysql/my.cnf --basedir=/mysqlsoft/mysql --datadir=/mysqldata/mysql --initialize


[root@cs2 mysql]# cat mysql.err
2019-05-31T06:01:50.260643Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2019-05-31T06:01:50.260731Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
 100
 100
2019-05-31T06:01:53.795162Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-05-31T06:01:54.049268Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-05-31T06:01:54.102171Z 0 [ERROR] unknown variable 'defaults-file=/mysqlsoft/mysql/my.cnf'
2019-05-31T06:01:54.102193Z 0 [ERROR] Aborting

网上有人说是文件权限的问题,然后重新授权chmod 664 my.cnf 但并没有解决,有人建议调整一下参数顺序就好!!!最后调整了一下参数顺序果然有效:

[root@cs2 bin]# ./mysqld  --defaults-file=/mysqlsoft/mysql/my.cnf --initialize --basedir=/mysqlsoft/mysql --datadir=/mysqldata/mysql --user=mysql

[root@cs2 mysql]# cat mysql.err
2019-05-31T06:05:06.362925Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2019-05-31T06:05:06.362994Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
 100
 100
2019-05-31T06:05:09.779913Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-05-31T06:05:10.026707Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-05-31T06:05:10.094462Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0be6983a-836a-11e9-a341-005056a092af.
2019-05-31T06:05:10.109209Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-05-31T06:05:10.110107Z 1 [Note] A temporary password is generated for root@localhost: ,;pm93qnL%-j
2019-05-31T06:05:14.966324Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2019-05-31T06:05:14.966373Z 1 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2019-05-31T06:05:14.966391Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2019-05-31T06:05:14.966419Z 1 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2019-05-31T06:05:14.966428Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2019-05-31T06:05:14.966441Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2019-05-31T06:05:14.966493Z 1 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2019-05-31T06:05:14.966508Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.

其中[Note] A temporary password is generated for root@localhost: ,;pm93qnL%-j的root@localhost: 后面跟的是mysql数据库登录的临时密码,各人安装生成的临时密码不一样。可以看到到日志文件没有报错,而且有了临时密码,表示初始化成功。

9. 如果想服务能够部署自动支持安全连接,使用mysql_ssl_rsa_setup工具来创建缺省SSL与RSA文件

[root@cs2 bin]# ./mysql_ssl_rsa_setup --datadir=/mysqldata/mysql
Generating a 2048 bit RSA private key
......................................................................+++
..............................................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
.............+++
..............+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
.....................................+++
................................................+++
writing new private key to 'client-key.pem'
-----

9.启动mysql服务

[root@cs2 /]# sh /mysqlsoft/mysql/support-files/mysql.server start
/mysqlsoft/mysql/support-files/mysql.server: line 239: my_print_defaults: command not found
/mysqlsoft/mysql/support-files/mysql.server: line 259: cd: /usr/local/mysql: No such file or directory
Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)

启动mysql服务命令会报错,因为没有修改mysql的配置文件
修改Mysql配置文件,修改前为以下内容

if test -z "$basedir"
then
  basedir=/usr/local/mysql
  bindir=/usr/local/mysql/bin
  if test -z "$datadir"
  then
    datadir=/usr/local/mysql/data
  fi
  sbindir=/usr/local/mysql/bin
  libexecdir=/usr/local/mysql/bin
else
  bindir="$basedir/bin"
  if test -z "$datadir"
  then
    datadir="$basedir/data"
  fi
  sbindir="$basedir/sbin"
  libexecdir="$basedir/libexec"
fi

修改后的内容如下

[root@cs2 ~]# vi /mysqlsoft/mysql/support-files/mysql.server
if test -z "$basedir"
then
  basedir=/mysqlsoft/mysql
  bindir=/mysqlsoft/mysql/bin
  if test -z "$datadir"
  then
    datadir=/mysqldata/mysql
  fi
  sbindir=/mysqlsoft/mysql/bin
  libexecdir=/mysqlsoft/mysql/bin
else
  bindir="$basedir/bin"
  if test -z "$datadir"
  then
    datadir="$basedir/data"
  fi
  sbindir="$basedir/sbin"
  libexecdir="$basedir/libexec"
fi


[root@cs2 ~]# cp /mysqlsoft/mysql/support-files/mysql.server  /etc/init.d/mysqld

[root@cs2 ~]# chmod 755 /etc/init.d/mysqld

10.启动mysql

[root@cs2 ~]# service mysqld start
Starting MySQL.. SUCCESS!

11.配置环境变量

[root@cs2 ~]# vi /etc/profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

export MYSQL_HOME=/mysqlsoft/mysql/
export PATH=$PATH:$MYSQL_HOME/bin

11.登录Mysql
初始化成功后,查看初始化密码

[root@cs2 ~]# cat /mysqldata/mysql/mysql.err | grep password
2019-05-31T06:05:10.110107Z 1 [Note] A temporary password is generated for root@localhost: ,;pm93qnL%-j

并输入刚刚复制的密码,但是 却提示不能通过mysql.sock文件实现连接

[root@cs2 bin]# ./mysqladmin -u root -p password
Enter password: 
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/mysqlsoft/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/mysqlsoft/mysql/mysql.sock' exists!

这里就奇怪了,因为在my.cnf文件中设置的socket文件路径为/mysqldata/mysql/mysql.sock,但mysql所使用的文件不是启动服务所生成的。

[root@cs2 ~]# cat /mysqlsoft/mysql/my.cnf
[mysqld]
basedir=/mysqlsoft/mysql
datadir=/mysqldata/mysql
bind-address=0.0.0.0
user=mysql
port=3306
log-error=/mysqldata/mysql/mysql.err
pid-file=/mysqldata/mysql/mysqld.pid
socket = /mysqldata/mysql/mysql.sock
character-set-server=utf8
default-storage-engine=INNODB
explicit_defaults_for_timestamp = true

[root@cs2 mysql]# ls -lrt
total 286896
-rw-r----- 1 mysql mysql 134217728 May 31 14:05 ib_logfile1
-rw-r----- 1 mysql mysql        56 May 31 14:05 auto.cnf
drwxr-x--- 2 mysql mysql      8192 May 31 14:05 performance_schema
drwxr-x--- 2 mysql mysql      4096 May 31 14:05 mysql
drwxr-x--- 2 mysql mysql      8192 May 31 14:05 sys
-rw------- 1 mysql mysql      1679 May 31 14:25 ca-key.pem
-rw-r--r-- 1 mysql mysql      1107 May 31 14:25 ca.pem
-rw------- 1 mysql mysql      1679 May 31 14:25 server-key.pem
-rw-r--r-- 1 mysql mysql      1107 May 31 14:25 server-cert.pem
-rw------- 1 mysql mysql      1679 May 31 14:25 client-key.pem
-rw-r--r-- 1 mysql mysql      1107 May 31 14:25 client-cert.pem
-rw------- 1 mysql mysql      1679 May 31 14:25 private_key.pem
-rw-r--r-- 1 mysql mysql       451 May 31 14:25 public_key.pem
-rw-r----- 1 mysql mysql       291 May 31 18:05 ib_buffer_pool
-rw------- 1 mysql mysql         6 May 31 18:08 mysql.sock.lock
srwxrwxrwx 1 mysql mysql         0 May 31 18:08 mysql.sock
-rw-r----- 1 mysql mysql         6 May 31 18:08 mysqld.pid
-rw-r----- 1 mysql mysql    101396 May 31 18:08 mysql.err
-rw-r----- 1 mysql mysql  12582912 May 31 18:08 ibtmp1
-rw-r----- 1 mysql mysql  12582912 May 31 18:08 ibdata1
-rw-r----- 1 mysql mysql 134217728 May 31 18:08 ib_logfile0

可以看到在/var/lib/mysql目录中的mysql.sock是指向/mysqlsoft/mysql/mysql.sock文件的。

[mysql@cs2 ~]$ ls -lrt /var/lib/mysql 
总用量 110604
-rw-rw----. 1   27   27 50331648 10月 11 2017 ib_logfile1
drwx------. 2   27   27     4096 10月 11 2017 performance_schema
drwx------. 2   27   27     4096 10月 11 2017 mysql
-rw-rw----. 1   27   27       56 10月 11 2017 auto.cnf
-rw-rw----. 1   27   27 50331648 5月  30 18:32 ib_logfile0
-rw-rw----. 1   27   27 12582912 5月  30 18:32 ibdata1
lrwxrwxrwx  1 root root       27 5月  31 15:44 mysql.sock -> /mysqlsoft/mysql/mysql.sock

如果使用-S选项来指定生成的mysql.sock文件进行登录是可以成功登录的

[mysql@cs2 mysql]$  mysql -S /mysqldata/mysql/mysql.sock -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.22 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit

修改socket文件路径为/mysqlsoft/mysql/mysql.sock

[root@cs2 ~]# cat /mysqlsoft/mysql/my.cnf
[mysqld]
basedir=/mysqlsoft/mysql
datadir=/mysqldata/mysql
bind-address=0.0.0.0
user=mysql
port=3306
log-error=/mysqldata/mysql/mysql.err
pid-file=/mysqldata/mysql/mysqld.pid
socket = /mysqlsoft/mysql/mysql.sock
character-set-server=utf8
default-storage-engine=INNODB
explicit_defaults_for_timestamp = true

再重启mysql服务

[root@cs2 ~]# service mysqld stop
Shutting down MySQL.. SUCCESS! 
[root@cs2 ~]# service mysqld start
Starting MySQL.. SUCCESS!

[mysql@cs2 ~]$ mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.22 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

这就可以登录了。

12.重置root用户密码

[mysql@cs2 ~]$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password=password("123456");
Query OK, 0 rows affected, 1 warning (0.00 sec)

13.设置允许远程登录mysql
如果要远程访问数据库,只需要把拥有全部权限的root账号对应的记录的Host字段改为%就可以了

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to root@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

测试远程登录

-bash-4.2$ mysql -h 10.11.13.19 -P 3306 -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.22 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SELECT DISTINCT CONCAT('User: [', user, '''@''', host, '];') AS USER_HOST FROM user; 
+------------------------------------+
| USER_HOST                          |
+------------------------------------+
| User: [root'@'%];                  |
| User: [mysql.session'@'localhost]; |
| User: [mysql.sys'@'localhost];     |
+------------------------------------+
3 rows in set (0.05 sec)

到此所有的安装步骤就完成,安装还是相当简单的。

当用户无限制使用表空间配额且表空间有足够空间时在执行DML操作时出现超出表空间的空间限额

朋友生产数据库在向特定的一张表插入数据时报超出表空间data的空间限额如是执行下查看用户所用的表空间配额信息,查看用户所使用表空间的配额发现没有限制,因为max_bytes为 -1

SQL>  select * from dba_ts_quotas where username='data';

TABLESPACE_NAME                USERNAME                            BYTES  MAX_BYTES     BLOCKS MAX_BLOCKS DROPPED
------------------------------ ------------------------------ ---------- ---------- ---------- ---------- -------
data                           data                           8825732464         -1  107735992         -1 NO

 1 rows selected

SQL>
SQL> select
  2    fs.tablespace_name            "Tablespace",
  3    (df.totalspace-fs.freespace)  "Used MB",
  4    fs.freespace                  "Free MB",
  5    df.totalspace                 "Total MB",
  6    round(100*(fs.freespace/df.totalspace)) "Pct. Free"
  7  from
  8    (select tablespace_name,round(sum(bytes)/1024/1024) TotalSpace
  9    from dba_data_files group by  tablespace_name) df,
 10    (select tablespace_name,round(sum(bytes)/1024/1024) FreeSpace
 11    from dba_free_space group by tablespace_name) fs
 12  where df.tablespace_name=fs.tablespace_name;

Tablespace                        Used MB    Free MB   Total MB  Pct. Free
------------------------------ ---------- ---------- ---------- ----------
SYSTEM                               7207       3033      10240         30
TEST                                 6790      34170      40960         83
USERS                                 173      25427      25600         99
UNDOTBS2                              227      24013      24240         99
DATA                               990119     176281    1166400         15
SYSAUX                               3925       1195       5120         23
UNDOTBS1                            12898      28062      40960         69

7 rows selected

查看表lv_data的依赖对象

SQL> select NAME,TYPE from dba_dependencies where REFERENCED_NAME='LV_DATA';

NAME                           TYPE
------------------------------ ------------------
LV_DATA                        VIEW
FC_UPDATE_CORPFUND             PROCEDURE
FC_UPDATE_MY                   PROCEDURE
FC_UPDATE_KY                   PROCEDURE
FC_UPDATE_FACTPAY              PROCEDURE
FC_UPDATE_CALCPAY              PROCEDURE
FC_UPDATE_KY                   PROCEDURE
......
LV_DATA                        SYNONYM
LV_DATA                        VIEW
LV_DATA                        SYNONYM
LV_DATA                        SYNONYM

139 rows selected

查看所有依赖对象的所有者

SQL> select  distinct owner from dba_objects where OBJECT_NAME in(select NAME from dba_dependencies where REFERENCED_NAME='LV_DATA');

OWNER
------------------------------
SY
SY_BK
WEB
CX
DATA
OLD
TEST
XC
CZ
OSY
BACKUP
TJ

12 rows selected

对所有依赖对象所有者授权可以无限制使用表空间

SQL> grant unlimited tablespace to OSY;

Grant succeeded

SQL> grant unlimited tablespace to SBK;

Grant succeeded

SQL> grant unlimited tablespace to WEB;

Grant succeeded

SQL> grant unlimited tablespace to CX;

Grant succeeded

SQL> grant unlimited tablespace to DATA;

Grant succeeded

SQL> grant unlimited tablespace to OLD;

Grant succeeded

SQL> grant unlimited tablespace to TEST;

Grant succeeded

SQL> grant unlimited tablespace to XC;

Grant succeeded

SQL> grant unlimited tablespace to CZ;

Grant succeeded

SQL> grant unlimited tablespace to SY;

Grant succeeded

SQL> grant unlimited tablespace to BACKUP;

Grant succeeded

SQL> grant unlimited tablespace to TJ;

Grant succeeded

再向表lv_data插入数据时恢复正常

sql server 2005 数据修改的内部原理

当插入新的记录到数据表中时,SQL Server必须决定在哪里插入记录。如果数据表没有聚集索引—也就是说,数据表还是堆表的话–新的记录总是插到表中任何有可用空间的地方。如果空间中没有可用的分页,SQL Server会尝试从已经分配给对象的现有的统一扩展中寻找未分配的分页。如果这样的分页也不存在,SQL Server就必须为数据表分配一个全新的扩展。

聚集索引根据新记录的聚集索引键列的值将插入导向到特定的分页。当新的记录是插入语句的直接结果或者是由“删除+插入”策略所执行的更新语句的结果时就会发生插入。SQL Server将新的记录插入到聚集索引中的合适位置,如果当前分页没有可用空间的话,会通过页拆分(page split)在分页中进行接合。如果不将聚集索引 声明为唯一性并插入具有重复键值的记录时,SQL Server会为所有后续的具有相同键值的记录自动生成一个唯一标识符(uniqueifier)。于是,SQL Server在内部将所有的聚集索引键都看作是唯一的。

页拆分(Splitting Pages)
SQL Server找到新的可用分页以后,原来的分页就要被拆分:行的一半留在原来的分页上,而另一半则被移到新的分页上。在某些情况下,由于变长字段的长度可能会变得远远大于分页上任何现有的记录,SQL Server会发现即使在页拆分以后仍然没有可用空间来存放新的记录。拆分后,一条或多条记录会被提升到父级分页中。如果只需要一次拆分,那么就提升一条记录。然而,如果在一次拆分后仍然无法容纳新的记录,那么就可能会潜在地产生多个新的分页并产生多次到父级分页的提升。举例来说,比如一个具有32行数据的分页。假设SQL Server尝试插入一条8000个字节长的新记录。SQL Server会对该分页进行一次拆分,但是无法丙容纳一条800个字节长的新记录。即使在第二次拆分后,仍然无法容纳新的记录。最终,SQL Server会意识到如果分页中有任何其他记录存在的话是无法容纳这条新记录的,因此它会分配一个新的分页来容纳这条唯一的新记录。于是,会发生几次页拆分,产生许多新的分页以及父级分页中的许多新的行。

SQL Server总是从根节点向下搜索索引树的,因此在插入操作的过程中,分页是在下层中进行的。这意味着当插入操作搜索索引的时候,需要将索引保护起来防止可能的更新操作。这种保护机制使用闩锁。当分页被读取或者被写入磁盘的时候,SQL Server会获取闩锁来保护分页内容的物理完整性。父节点(非叶节点)被闩锁锁住直到得知子节点拥有自己的闩锁来保护时为止。然后,父级的闩锁就可以安全地被释放掉了。

在父级节点上的闩锁被释放以前,SQL Server会判断分页是否能够容纳另两行数据。如果不能的话,就进行页拆分。最终目的是确保父级分页总是有足够的空间容纳记录或者由子分页拆分所得到的记录(有时候这会导致无需进行页拆分–至少尚未拆分。这将带来性能上的优化)。拆分的类型取决于被拆分分页的类型:索引的根分页,中间级的索引分页以及数据分页。

拆分索引的根分页
如果索引的根分页需要为插入一条新的索引也被拆分的话,SQL Server会为此索引分配两个新的分页。根分页中的所有记录在这两个新分页中被拆分,而新的索引行也被插入到这些分页之中的某个合适的位置。原来的根分页仍然是根,但是现在上面只有两条记录,指向新分配的两个分页。根的页拆分会在索引中创建一个新的级别。由于索引通常只有几层的深度,这种类型的拆分并不会经常发生。

拆分中间级索引分页
中间级索引分页的拆分是通过定位分页上索引键的中点,分配新的分页并将旧的索引分页中较低的一半复制到新的分页来实现的。同样地,尽管这比根分页的拆分要常见一些,但这种情况也并不会经常发生。

拆分数据分页
数据分页的拆分是最值得关注也是最可能发生的情况,并且这也可能是开发者唯一应该关注的拆分类型。数据分页的拆分只有在表上存在聚集索引且进行插入操作时才会发生。如果不存在聚集索引,SQL Server会根据PFS分页在任何可以容纳新记录的分页上完成插入。尽管只有插入行为才会引起拆分,但这种插入行为也可能是update语句产生的结果,而不仅仅针对insert语句。正如下面将要介绍的,如果行不能在原处被更新或者至少在同一个分页中被更新的话,更新操作实际上就被分解为先删除原始行再插入行的一个新版本。当然,插入新的记录还会造成页拆分。

拆分数据分页是一个复杂的操作。与拆分中间级索引分页非常类似的是,SQL Server也是通过定位分页上的索引键的中点,分配新的分页并将旧的索引分页中较低的一半复制到新的分页来实现的。这需要索引管理器决定在哪个分页上放置新的记录并且能够处理原业的旧分页和新分页都不能容纳的大的行记录。当数据分页被拆分时,聚集索引键值不会改变,因而非聚集索引也不会受到影响。

下面来看看当发生拆分时分页上的情况。下面的脚本新建了一个具有较大行记录的数据表bigrows—相当大,实际上一个分页上只能容纳五行数据。一旦表被创建并插入五行记录以后,我们可以通过如下步骤找到该表的第一个分页(在本例中也是唯一的分页):将dbcc ind的输出结果插入到sp_table_pages表中,寻找没有前一页的数据分页的信息然后使用dbcc page来查看分页的内容。由于没有必要查看分页上所有的8020个字节的数据,我们只需要查看分页末尾的行偏移数组并观察当插入第六条记录时分页上的情况。

/*首先创建数据表bigrows */
use adventureworks;
GO

drop table bigrows;
GO

create table bigrows
(
a int primary key,
b varchar(1600)
);
GO

/* 向表中插入五行数据 */
insert into bigrows values(5,replicate('a',1600));
insert into bigrows values(10,replicate('b',1600));
insert into bigrows values(15,replicate('c',1600));
insert into bigrows values(20,replicate('d',1600));
insert into bigrows values(25,replicate('e',1600));
GO

truncate table sp_table_pages;
insert into sp_table_pages exec('dbcc ind(adventureworks,bigrows,-1)');
select pagefid,pagepid from sp_table_pages where pagetype=1;

DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。

(2 行受影响)
pagefid pagepid
------- -----------
1 20996

(1 行受影响)

dbcc traceon(3604);
GO
dbcc page(adventureworks,1,20996,1);

DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。

PAGE: (1:20996)

BUFFER:

BUF @0x0000000083FD7F80

bpage = 0x00000000835FE000 bhash = 0x0000000000000000 bpageno = (1:20996)
bdbid = 6 breferences = 0 bUse1 = 686
bstat = 0xc0010b blog = 0x212121bb bnext = 0x0000000000000000

PAGE HEADER:

Page @0x00000000835FE000

m_pageId = (1:20996) m_headerVersion = 1 m_type = 1
m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0x8000
m_objId (AllocUnitId.idObj) = 346 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72057594060603392
Metadata: PartitionId = 72057594054311936 Metadata: IndexId = 1
Metadata: ObjectId = 743673697 m_prevPage = (0:0) m_nextPage = (0:0)
pminlen = 8 m_slotCnt = 5 m_freeCnt = 11
m_freeData = 8171 m_reservedCnt = 0 m_lsn = (134:408:2)
m_xactReserved = 0 m_xdesId = (0:0) m_ghostRecCnt = 0
m_tornBits = 0

Allocation Status

GAM (1:2) = ALLOCATED SGAM (1:3) = ALLOCATED
PFS (1:16176) = 0x60 MIXED_EXT ALLOCATED 0_PCT_FULL DIFF (1:6) = CHANGED
ML (1:7) = NOT MIN_LOGGED

DATA:

Slot 0, Offset 0x60, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x000000000E22C060

0000000000000000: 30000800 05000000 0200fc01 004f0661 ?0............O.a
0000000000000010: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000020: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000030: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000040: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000050: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000060: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000070: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000080: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000090: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000100: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000110: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000120: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000130: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000140: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000150: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000160: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000170: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000180: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000190: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000200: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000210: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000220: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000230: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000240: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000250: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000260: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000270: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000280: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000290: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000300: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000310: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000320: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000330: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000340: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000350: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000360: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000370: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000380: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000390: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000400: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000410: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000420: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000430: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000440: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000450: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000460: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000470: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000480: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000490: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000500: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000510: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000520: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000530: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000540: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000550: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000560: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000570: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000580: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000590: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000600: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000610: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000620: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000630: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000640: 61616161 61616161 61616161 616161????aaaaaaaaaaaaaaa

Slot 1, Offset 0x6af, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x000000000E22C6AF

0000000000000000: 30000800 0a000000 0200fc01 004f0662 ?0............O.b
0000000000000010: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000020: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000030: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000040: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000050: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000060: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000070: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000080: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000090: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000100: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000110: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000120: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000130: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000140: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000150: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000160: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000170: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000180: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000190: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000200: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000210: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000220: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000230: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000240: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000250: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000260: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000270: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000280: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000290: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000300: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000310: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000320: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000330: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000340: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000350: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000360: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000370: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000380: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000390: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000400: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000410: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000420: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000430: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000440: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000450: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000460: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000470: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000480: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000490: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000500: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000510: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000520: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000530: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000540: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000550: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000560: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000570: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000580: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000590: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000600: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000610: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000620: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000630: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000640: 62626262 62626262 62626262 626262????bbbbbbbbbbbbbbb

Slot 2, Offset 0xcfe, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x000000000E22CCFE

0000000000000000: 30000800 0f000000 0200fc01 004f0663 ?0............O.c
0000000000000010: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000020: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000030: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000040: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000050: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000060: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000070: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000080: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000090: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000100: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000110: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000120: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000130: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000140: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000150: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000160: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000170: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000180: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000190: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000200: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000210: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000220: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000230: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000240: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000250: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000260: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000270: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000280: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000290: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000300: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000310: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000320: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000330: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000340: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000350: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000360: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000370: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000380: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000390: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000400: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000410: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000420: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000430: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000440: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000450: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000460: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000470: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000480: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000490: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000500: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000510: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000520: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000530: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000540: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000550: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000560: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000570: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000580: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000590: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000600: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000610: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000620: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000630: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000640: 63636363 63636363 63636363 636363????ccccccccccccccc

Slot 3, Offset 0x134d, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x000000000E22D34D

0000000000000000: 30000800 14000000 0200fc01 004f0664 ?0............O.d
0000000000000010: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000020: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000030: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000040: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000050: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000060: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000070: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000080: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000090: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000100: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000110: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000120: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000130: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000140: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000150: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000160: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000170: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000180: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000190: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000200: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000210: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000220: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000230: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000240: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000250: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000260: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000270: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000280: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000290: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000300: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000310: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000320: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000330: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000340: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000350: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000360: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000370: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000380: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000390: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000400: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000410: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000420: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000430: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000440: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000450: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000460: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000470: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000480: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000490: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000500: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000510: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000520: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000530: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000540: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000550: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000560: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000570: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000580: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000590: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000600: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000610: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000620: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000630: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000640: 64646464 64646464 64646464 646464????ddddddddddddddd

Slot 4, Offset 0x199c, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x000000000E22D99C

0000000000000000: 30000800 19000000 0200fc01 004f0665 ?0............O.e
0000000000000010: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000020: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000030: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000040: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000050: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000060: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000070: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000080: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000090: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000100: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000110: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000120: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000130: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000140: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000150: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000160: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000170: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000180: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000190: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000200: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000210: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000220: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000230: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000240: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000250: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000260: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000270: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000280: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000290: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000300: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000310: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000320: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000330: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000340: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000350: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000360: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000370: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000380: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000390: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000400: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000410: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000420: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000430: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000440: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000450: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000460: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000470: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000480: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000490: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000500: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000510: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000520: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000530: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000540: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000550: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000560: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000570: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000580: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000590: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000600: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000610: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000620: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000630: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000640: 65656565 65656565 65656565 656565????eeeeeeeeeeeeeee

下面是从dbcc page输出结果中得到的行偏移数组:

OFFSET TABLE:

Row - Offset
4 (0x4) - 6556 (0x199c)
3 (0x3) - 4941 (0x134d)
2 (0x2) - 3326 (0xcfe)
1 (0x1) - 1711 (0x6af)
0 (0x0) - 96 (0x60)

DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。

下面插入一行新的记录并再次查看行偏移数组:

use adventureworks;
GO
insert into bigrows values(22,replicate('x',1600));
GO

从m_nextPage = (1:20999)结果可知现在有两个数据分页,下一个分页号为20999。

PAGE: (1:20996)

BUFFER:

BUF @0x0000000083FD7F80

bpage = 0x00000000835FE000 bhash = 0x0000000000000000 bpageno = (1:20996)
bdbid = 6 breferences = 0 bUse1 = 4322
bstat = 0xc0010b blog = 0x212121bb bnext = 0x0000000000000000

PAGE HEADER:

Page @0x00000000835FE000

m_pageId = (1:20996) m_headerVersion = 1 m_type = 1
m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0x0
m_objId (AllocUnitId.idObj) = 346 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72057594060603392
Metadata: PartitionId = 72057594054311936 Metadata: IndexId = 1
Metadata: ObjectId = 743673697 m_prevPage = (0:0) m_nextPage = (1:20999)
pminlen = 8 m_slotCnt = 3 m_freeCnt = 3245
m_freeData = 8171 m_reservedCnt = 0 m_lsn = (134:416:17)
m_xactReserved = 0 m_xdesId = (0:0) m_ghostRecCnt = 0
m_tornBits = 0

Allocation Status

GAM (1:2) = ALLOCATED SGAM (1:3) = ALLOCATED
PFS (1:16176) = 0x60 MIXED_EXT ALLOCATED 0_PCT_FULL DIFF (1:6) = CHANGED
ML (1:7) = NOT MIN_LOGGED

DATA:

Slot 0, Offset 0x60, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x0000000003A8C060

0000000000000000: 30000800 05000000 0200fc01 004f0661 ?0............O.a
0000000000000010: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000020: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000030: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000040: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000050: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000060: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000070: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000080: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000090: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000100: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000110: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000120: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000130: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000140: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000150: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000160: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000170: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000180: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000190: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000200: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000210: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000220: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000230: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000240: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000250: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000260: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000270: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000280: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000290: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000300: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000310: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000320: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000330: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000340: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000350: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000360: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000370: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000380: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000390: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000400: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000410: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000420: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000430: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000440: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000450: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000460: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000470: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000480: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000490: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000500: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000510: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000520: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000530: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000540: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000550: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000560: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000570: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000580: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000590: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000600: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000610: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000620: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000630: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000640: 61616161 61616161 61616161 616161????aaaaaaaaaaaaaaa

Slot 1, Offset 0x6af, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x0000000003A8C6AF

0000000000000000: 30000800 0a000000 0200fc01 004f0662 ?0............O.b
0000000000000010: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000020: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000030: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000040: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000050: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000060: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000070: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000080: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000090: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000100: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000110: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000120: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000130: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000140: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000150: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000160: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000170: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000180: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000190: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000200: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000210: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000220: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000230: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000240: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000250: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000260: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000270: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000280: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000290: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000300: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000310: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000320: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000330: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000340: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000350: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000360: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000370: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000380: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000390: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000400: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000410: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000420: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000430: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000440: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000450: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000460: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000470: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000480: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000490: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000500: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000510: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000520: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000530: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000540: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000550: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000560: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000570: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000580: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000590: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000600: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000610: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000620: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000630: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000640: 62626262 62626262 62626262 626262????bbbbbbbbbbbbbbb

Slot 2, Offset 0xcfe, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x0000000003A8CCFE

0000000000000000: 30000800 0f000000 0200fc01 004f0663 ?0............O.c
0000000000000010: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000020: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000030: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000040: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000050: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000060: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000070: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000080: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000090: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000100: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000110: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000120: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000130: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000140: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000150: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000160: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000170: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000180: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000190: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000200: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000210: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000220: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000230: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000240: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000250: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000260: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000270: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000280: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000290: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000300: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000310: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000320: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000330: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000340: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000350: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000360: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000370: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000380: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000390: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000400: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000410: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000420: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000430: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000440: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000450: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000460: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000470: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000480: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000490: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000500: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000510: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000520: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000530: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000540: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000550: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000560: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000570: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000580: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000590: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000600: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000610: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000620: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000630: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000640: 63636363 63636363 63636363 636363????ccccccccccccccc

OFFSET TABLE:

Row - Offset
2 (0x2) - 3326 (0xcfe)
1 (0x1) - 1711 (0x6af)
0 (0x0) - 96 (0x60)

DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。

在拆分后检查原来的数据分页发现它既有可能包含原始分页的上半部分的行记录也可能是下半部分。SQL Server通常会移动记录因而新插入的记录会移动到新的分页上去。因为这些行记录无论如何都会移动,因此调整它们的位置来容纳新插入的记录就更具有意义了。在这个例子中,新的记录,其聚集键值为22,会被插入到分页的下半部分中去。因此当发生页拆分时,前三行仍然留在原始分页20996中。可以检查页头来找到下一个包含新记录的分页位置。其中,m_nextPage域指明了页号。该值以十进制的格式表示为文件号;分页号对,因此可以很容易地将其运用在dbcc page命令中。当我运行该查询时,得到的m_nextPage的值为1:20999,因此要执行如下命令:

use adventureworks;
GO
dbcc traceon(3604);
GO
dbcc page(adventureworks,1,20999,1)

DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。

PAGE: (1:20999)

BUFFER:

BUF @0x0000000083FF9C80

bpage = 0x0000000083E72000 bhash = 0x0000000000000000 bpageno = (1:20999)
bdbid = 6 breferences = 0 bUse1 = 7865
bstat = 0xc0010b blog = 0x212121bb bnext = 0x0000000000000000

PAGE HEADER:

Page @0x0000000083E72000

m_pageId = (1:20999) m_headerVersion = 1 m_type = 1
m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0x0
m_objId (AllocUnitId.idObj) = 346 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72057594060603392
Metadata: PartitionId = 72057594054311936 Metadata: IndexId = 1
Metadata: ObjectId = 743673697 m_prevPage = (1:20996) m_nextPage = (0:0)
pminlen = 8 m_slotCnt = 3 m_freeCnt = 3245
m_freeData = 4941 m_reservedCnt = 0 m_lsn = (134:416:20)
m_xactReserved = 0 m_xdesId = (0:0) m_ghostRecCnt = 0
m_tornBits = 0

Allocation Status

GAM (1:2) = ALLOCATED SGAM (1:3) = ALLOCATED
PFS (1:16176) = 0x60 MIXED_EXT ALLOCATED 0_PCT_FULL DIFF (1:6) = CHANGED
ML (1:7) = NOT MIN_LOGGED

DATA:

Slot 0, Offset 0x60, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x0000000003A8C060

0000000000000000: 30000800 14000000 0200fc01 004f0664 ?0............O.d
0000000000000010: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000020: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000030: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000040: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000050: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000060: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000070: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000080: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000090: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000000F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000100: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000110: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000120: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000130: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000140: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000150: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000160: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000170: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000180: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000190: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000001F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000200: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000210: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000220: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000230: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000240: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000250: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000260: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000270: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000280: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000290: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000002F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000300: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000310: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000320: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000330: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000340: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000350: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000360: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000370: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000380: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000390: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000003F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000400: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000410: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000420: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000430: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000440: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000450: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000460: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000470: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000480: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000490: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000004F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000500: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000510: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000520: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000530: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000540: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000550: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000560: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000570: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000580: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000590: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005A0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005B0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005C0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005D0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005E0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
00000000000005F0: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000600: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000610: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000620: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000630: 64646464 64646464 64646464 64646464 ?dddddddddddddddd
0000000000000640: 64646464 64646464 64646464 646464????ddddddddddddddd

Slot 1, Offset 0xcfe, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x0000000003A8CCFE

0000000000000000: 30000800 16000000 0200fc01 004f0678 ?0............O.x
0000000000000010: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000020: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000030: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000040: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000050: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000060: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000070: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000080: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000090: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000000A0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000000B0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000000C0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000000D0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000000E0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000000F0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000100: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000110: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000120: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000130: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000140: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000150: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000160: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000170: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000180: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000190: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000001A0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000001B0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000001C0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000001D0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000001E0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000001F0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000200: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000210: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000220: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000230: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000240: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000250: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000260: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000270: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000280: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000290: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000002A0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000002B0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000002C0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000002D0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000002E0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000002F0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000300: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000310: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000320: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000330: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000340: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000350: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000360: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000370: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000380: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000390: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000003A0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000003B0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000003C0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000003D0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000003E0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000003F0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000400: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000410: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000420: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000430: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000440: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000450: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000460: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000470: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000480: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000490: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000004A0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000004B0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000004C0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000004D0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000004E0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000004F0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000500: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000510: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000520: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000530: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000540: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000550: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000560: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000570: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000580: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000590: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000005A0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000005B0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000005C0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000005D0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000005E0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000005F0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000600: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000610: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000620: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000630: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000640: 78787878 78787878 78787878 787878????xxxxxxxxxxxxxxx

Slot 2, Offset 0x6af, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x0000000003A8C6AF

0000000000000000: 30000800 19000000 0200fc01 004f0665 ?0............O.e
0000000000000010: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000020: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000030: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000040: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000050: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000060: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000070: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000080: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000090: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000000F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000100: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000110: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000120: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000130: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000140: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000150: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000160: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000170: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000180: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000190: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000001F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000200: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000210: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000220: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000230: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000240: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000250: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000260: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000270: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000280: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000290: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000002F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000300: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000310: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000320: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000330: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000340: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000350: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000360: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000370: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000380: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000390: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000003F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000400: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000410: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000420: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000430: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000440: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000450: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000460: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000470: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000480: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000490: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000004F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000500: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000510: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000520: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000530: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000540: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000550: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000560: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000570: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000580: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000590: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005A0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005B0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005C0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005D0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005E0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
00000000000005F0: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000600: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000610: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000620: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000630: 65656565 65656565 65656565 65656565 ?eeeeeeeeeeeeeeee
0000000000000640: 65656565 65656565 65656565 656565????eeeeeeeeeeeeeee

OFFSET TABLE:

下面是插入以后第二个分页上的行偏移数组:

Row - Offset
2 (0x2) - 1711 (0x6af)
1 (0x1) - 3326 (0xcfe)
0 (0x0) - 96 (0x60)

DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。

注意,在页拆分以后,此分页上有三行记录:原始分页上的后两条记录(键值为20和25),以及值为22的新记录。如果检查分页上的实际数据的话,会注意到新的记录在槽号(slot)为1的地方,即使该记录本身的确是分页上物理顺序中的最后条记录。槽1(键值为22)从偏移量3326处开始,而槽2(键值为25)则从偏移量1711处开始。行的聚集索引键序是由行的槽号指明的,而不是在分页上的物理位置。如果数据表包含聚集索引,那么在槽1处的记录的键值总是小于槽2处记录的键值而大于槽0处记录的键值。

尽管典型的页拆分的代价并不十分高昂,但是用户还是希望能够尽可能降低生产系统中的页拆分频率,至少在使用高峰的时刻会如此。一次页拆分开锁很低,但成千上百的拆分就不是了。可以通过在现有数据上创建聚集索引时使用filefactor子句在分页上预留一些空间来避免高峰时刻可能的系统崩溃。可以在系统运营最不繁忙的时雄姿英发定期使用期望的填充因子重建索引对系统进行优化。按照这种方式,在高峰时刻依然有额外的空间可以使用,并且可以因此节省拆分带来的开锁。如果系统不存在“不活跃”的时间,可以使用alter index对索引进行重组并调整填充因子,而不必使整张表都陷入不可使用的状态。注意:带有reorganize的alter index语句只能通过压缩数据和转移分页来调整填充因子,它不会通过添加新的分页来重置填充因子。利用SQL Server代理可以很轻松地在系统不繁忙时安排索引的重建或重组。

删除数据
当从一张数据表中删除记录时,必须同时考虑数据分页和索引分页上的变化。谨记聚集索引的叶级别实际上就是数据本身,而从带有聚集索引的表中删除数据的方式与从非聚集索引 的叶级别删除记录完全一样。从堆表中删除记录则是另一种处理方式,类似于从索引的结点分页中进行删除。

从堆表中删除记录
SQL Server 2005不会在行被删除时自动压缩分页上的空间。考虑到性能优化,在分页需要额外的连续空间来插入新的记录以前都不会进行数据压缩。下面的盒子从分页中间删除一行数据然后使用dbcc page来查看分页。

use adventureworks;
GO

create table smallrows
(
a int identity,
b char(10)
);
GO

insert into smallrows values('row 1');
insert into smallrows values('row 2');
insert into smallrows values('row 3');
insert into smallrows values('row 4');
insert into smallrows values('row 5');

truncate table sp_table_pages;

insert into sp_table_pages exec('dbcc ind(adventureworks,smallrows,-1)');

select pagefid,pagepid from sp_table_pages where pagetype=1;
结果:
pagefid pagepid
------- -----------
1 21920

(1 行受影响)

use adventureworks;
GO
dbcc traceon(3604);
GO
dbcc page(adventureworks,1,21920,1)

下面是dbcc page的输出结果

PAGE: (1:21920)

BUFFER:

BUF @0x0000000083FF9480

bpage = 0x0000000083E52000 bhash = 0x0000000000000000 bpageno = (1:21920)
bdbid = 6 breferences = 0 bUse1 = 3478
bstat = 0xc0010b blog = 0x212121bb bnext = 0x0000000000000000

PAGE HEADER:

Page @0x0000000083E52000

m_pageId = (1:21920) m_headerVersion = 1 m_type = 1
m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0x8000
m_objId (AllocUnitId.idObj) = 347 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72057594060668928
Metadata: PartitionId = 72057594054377472 Metadata: IndexId = 0
Metadata: ObjectId = 775673811 m_prevPage = (0:0) m_nextPage = (0:0)
pminlen = 18 m_slotCnt = 5 m_freeCnt = 7981
m_freeData = 201 m_reservedCnt = 0 m_lsn = (134:472:3)
m_xactReserved = 0 m_xdesId = (0:0) m_ghostRecCnt = 0
m_tornBits = 0

Allocation Status

GAM (1:2) = ALLOCATED SGAM (1:3) = ALLOCATED
PFS (1:16176) = 0x61 MIXED_EXT ALLOCATED 50_PCT_FULL DIFF (1:6) = CHANGED
ML (1:7) = NOT MIN_LOGGED

DATA:

Slot 0, Offset 0x60, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C060

0000000000000000: 10001200 01000000 726f7720 31202020 ?........row 1
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 1, Offset 0x75, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C075

0000000000000000: 10001200 02000000 726f7720 32202020 ?........row 2
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 2, Offset 0x8a, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C08A

0000000000000000: 10001200 03000000 726f7720 33202020 ?........row 3
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 3, Offset 0x9f, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C09F

0000000000000000: 10001200 04000000 726f7720 34202020 ?........row 4
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 4, Offset 0xb4, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C0B4

0000000000000000: 10001200 05000000 726f7720 35202020 ?........row 5
0000000000000010: 20200200 fc?????????????????????????? ...

OFFSET TABLE:

Row - Offset
4 (0x4) - 180 (0xb4)
3 (0x3) - 159 (0x9f)
2 (0x2) - 138 (0x8a)
1 (0x1) - 117 (0x75)
0 (0x0) - 96 (0x60)

现在删除中间一行数据(where a=3)并再次查看分页的内容

use adventureworks;
GO
delete from smallrows where a=3;
GO
dbcc traceon(3604);
GO
dbcc page(adventureworks,1,21920,1)

下面是第二次执行dbcc page的输出结果

PAGE: (1:21920)

BUFFER:

BUF @0x0000000083FF9480

bpage = 0x0000000083E52000 bhash = 0x0000000000000000 bpageno = (1:21920)
bdbid = 6 breferences = 3 bUse1 = 3693
bstat = 0xc0010b blog = 0x212121bb bnext = 0x0000000000000000

PAGE HEADER:

Page @0x0000000083E52000

m_pageId = (1:21920) m_headerVersion = 1 m_type = 1
m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0x8008
m_objId (AllocUnitId.idObj) = 347 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72057594060668928
Metadata: PartitionId = 72057594054377472 Metadata: IndexId = 0
Metadata: ObjectId = 775673811 m_prevPage = (0:0) m_nextPage = (0:0)
pminlen = 18 m_slotCnt = 5 m_freeCnt = 8002
m_freeData = 201 m_reservedCnt = 21 m_lsn = (134:488:2)
m_xactReserved = 21 m_xdesId = (0:18192) m_ghostRecCnt = 0
m_tornBits = 0

Allocation Status

GAM (1:2) = ALLOCATED SGAM (1:3) = ALLOCATED
PFS (1:16176) = 0x61 MIXED_EXT ALLOCATED 50_PCT_FULL DIFF (1:6) = CHANGED
ML (1:7) = NOT MIN_LOGGED

DATA:

Slot 0, Offset 0x60, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C060

0000000000000000: 10001200 01000000 726f7720 31202020 ?........row 1
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 1, Offset 0x75, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C075

0000000000000000: 10001200 02000000 726f7720 32202020 ?........row 2
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 3, Offset 0x9f, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C09F

0000000000000000: 10001200 04000000 726f7720 34202020 ?........row 4
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 4, Offset 0xb4, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C0B4

0000000000000000: 10001200 05000000 726f7720 35202020 ?........row 5
0000000000000010: 20200200 fc?????????????????????????? ...

OFFSET TABLE:

Row - Offset
4 (0x4) - 180 (0xb4)
3 (0x3) - 159 (0x9f)
2 (0x2) - 0 (0x0)
1 (0x1) - 117 (0x75)
0 (0x0) - 96 (0x60)

注意在堆表中,这行数据就不会出现在分页中了。分页底部的行偏移数组显示第三行数据(槽2)现在位于偏移量0处(这意味着现在没有行使用槽2),而占用槽3的行仍然在位于和删除前相同的偏移量处。分页上的数据并没有被压缩。

除了分页上的空间不被回收之外,堆表中的空闲分页也经常无法被回收。即使从堆表中删除了全部记录。SQL Server不会将空闲分页标记成未分配状态,因此这部分空间无法供其他对象使用。目录视图sys.dm_db_partition_stats会显示这块空间仍然属于堆表。

从B树中删除记录
在索引的叶级别(无论聚集索引还是非聚集索引),当行记录被删除时,SQL Server会将其标记为虚影记录。这意味着这行记录仍然保留在分页上但是SQL Server会修改记录头中的一个比特位用来表示这行数据实际上是一个虚影。页头中也会反映出分页上的虚影记录数量。虚影记录有多种用途。它们可以使用回滚操作具有更高的效率;如果这行记录还没有被物理地移除掉,那么SQL Server要回滚删除操作的话就只需修改表示行为虚影的那个比特位即可。同样,虚影记录也是一种针对键范围锁定以及其他锁定模式的并发优化。虚影记录也被用来支持行版本控制。

虚影记录迟早还是会被清除掉的,取决于系统的负荷情况,而且有时SQL Server会在你有机会查看到以前就将其清除掉了。在下面所示的代码中,如果执行delete操作并等待一会儿再运行dbcc page的话,虚影记录可能就真的消失了。这就是为什么要在运行delete以前察看表中的分页数量,这样就可以在查询窗口中一次点击执行delete和dbcc page命令。为了确保虚影不被清除掉,可以将delete放到一个用户事务中并且在检查分页之前不提交或回滚该事务。清理线程不会清除属于活动事务的虚影记录。另外,可以使用未记载的跟踪标记661禁用虚影清理以确保像这个脚本一样运行浿时能够有一致的结果。通常,请记住未被记载的跟踪标记并不能保证在任何后续版本或者service pack中继续工作,并且不被微软支持。还要明确在完成测试以后必须关闭跟踪标记。

下面的例子新建了与前面delete例子中相同的数据表,但这次声明了一个主键,这意味着SQL Server会创建一个聚集索引。聚集索引的叶级别就是实际的数据,因此当记录被移除时,会被标记为虚影。

use adventureworks;
GO

drop table smallrows;
GO

create table smallrows
(
a int identity primary key,
b char(10)
);
GO

insert into smallrows values('row 1');
insert into smallrows values('row 2');
insert into smallrows values('row 3');
insert into smallrows values('row 4');
insert into smallrows values('row 5');

truncate table sp_table_pages;

insert into sp_table_pages exec('dbcc ind(adventureworks,smallrows,-1)');

select pagefid,pagepid from sp_table_pages where pagetype=1;
结果:
pagefid pagepid
------- -----------
1 21928

use adventureworks;
GO
delete from smallrows where a=3;
GO
dbcc traceon(3604);
GO
dbcc page(adventureworks,1,21928,1)

下面是dbcc page的输出结果:

PAGE: (1:21928)

BUFFER:

BUF @0x0000000084FF6000

bpage = 0x0000000084D80000 bhash = 0x0000000000000000 bpageno = (1:21928)
bdbid = 6 breferences = 3 bUse1 = 5368
bstat = 0xc0010b blog = 0x212121bb bnext = 0x0000000000000000

PAGE HEADER:

Page @0x0000000084D80000

m_pageId = (1:21928) m_headerVersion = 1 m_type = 1
m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0x0
m_objId (AllocUnitId.idObj) = 348 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72057594060734464
Metadata: PartitionId = 72057594054443008 Metadata: IndexId = 1
Metadata: ObjectId = 791673868 m_prevPage = (0:0) m_nextPage = (0:0)
pminlen = 18 m_slotCnt = 5 m_freeCnt = 7981
m_freeData = 201 m_reservedCnt = 0 m_lsn = (134:576:2)
m_xactReserved = 0 m_xdesId = (0:18204) m_ghostRecCnt = 1
m_tornBits = 0

Allocation Status

GAM (1:2) = ALLOCATED SGAM (1:3) = ALLOCATED
PFS (1:16176) = 0x68 MIXED_EXT ALLOCATED 0_PCT_FULL DIFF (1:6) = CHANGED
ML (1:7) = NOT MIN_LOGGED

DATA:

Slot 0, Offset 0x60, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C060

0000000000000000: 10001200 01000000 726f7720 31202020 ?........row 1
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 1, Offset 0x75, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C075

0000000000000000: 10001200 02000000 726f7720 32202020 ?........row 2
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 2, Offset 0x8a, Length 21, DumpStyle BYTE

Record Type = GHOST_DATA_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C08A

0000000000000000: 1c001200 03000000 726f7720 33202020 ?........row 3
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 3, Offset 0x9f, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C09F

0000000000000000: 10001200 04000000 726f7720 34202020 ?........row 4
0000000000000010: 20200200 fc?????????????????????????? ...

Slot 4, Offset 0xb4, Length 21, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP
Memory Dump @0x000000000E22C0B4

0000000000000000: 10001200 05000000 726f7720 35202020 ?........row 5
0000000000000010: 20200200 fc?????????????????????????? ...

OFFSET TABLE:

Row - Offset
4 (0x4) - 180 (0xb4)
3 (0x3) - 159 (0x9f)
2 (0x2) - 138 (0x8a)
1 (0x1) - 117 (0x75)
0 (0x0) - 96 (0x60)

注意,这行记录仍然会出现在分页中,因为数据表带有聚集索引。行的头信息表明这的确是一条虚影记录。分页末尾的行偏移数组显示槽2中的记录仍然在相同的偏移量处而且所有记录都和删除以前所在的位置相同。另外,页头还提供了分页中虚影记录的数量(m_ghostRecCnt = 1)。可以通过sys.dm_db_index_physical_stats看到数据表中虚影记录的总数

删除索引结点级中的记录
当从表中删除一行数据时,SQL Server必须维护所有的非聚集索引,因为每个非聚集索引都有一个指针指向现在消失了的那条记录。索引结点分页中的记录在被删除以后并不是虚影记录,但是与堆表分页一样,直到新的索引行需要该分页中的空间时,SQL Server才会压缩空间。

回收分页
当数据分页中的最后一条记录都被删除时,整个分页就被回收。例外发生在表是堆表结构的时候,正如之前讨论过的(如果此分页是表中剩下的唯一分页的话是不会被回收的。一张数据表总是包含至少一个分页,即使该分页是空的)。数据分页的回收将导致SQL Server删除索引分页中指向被回收的数据分页的那行记录。如果索引行被删除的话,那么索引分页就会被回收(同样,可能在删除/插入/更新策略时发生),只在索引分页中保留一个条目。该条目会被移到相邻的分页中,然后SQL Server将回收这个空闲分页。

到目前为止,所有的讨论都集中在删除一行记录所必需的分页操作上。如果一个删除操作删除掉多行记录,用户必须注意一些其他事项。由于在单个查询中修改多条记录对于插入,更新以及删除操作来说都是相同的。

更新行
SQL Server有多种方式可以更新行记录,它会自动隐式地为特定的操作选择最快速的更新策略。在决定策略的过程中,SQL Server会估计受到影响的记录数,按照怎样的方式访问记录(通过扫描,或者一次索引和索引获取)以及是否会对索引键进行修改。更新可以由查询处理器或者存储引擎来控制。在本小节中,我们只研究更新究竟按照原位替换的方式进行还是SQL Server将其按照两个独立的操作来处理;删除旧行并插入新行。更新是由哪个组件控制的问题;查询处理器还是存储引擎,实际上与所有数据修改操作都有关联(并不只与更新相关)。

移动行
如果表中的一条记录必须移到新的位置时又会怎么样呢?在SQL Server 2005中,当一条带有变长字段的记录被更新了一个新的较大的值,使得原始分页无法再容纳此记录时,会发生移动行的情况。这也可能在改变聚集索引的字段时发生,因为数据行是根据聚集键进行逻辑排序的。举例来说,如果在lastname字段上有一个聚集索引,那么一条lastname值为Abbot的记录会存储到接近表头的位置。如果接着将lastname值更新为Zappa,那么就必须将这行数据移到靠近表尾的地方。

前面部分曾经了解了索引的结构并知道非聚集索引的叶级别的每个结点都包含一个行定位符(或者书签)指向数据表中的每行记录。如果表上有聚集索引,那么行定位符就是该行数据的聚集键。因此,当且仅当聚集索引键被更新时,才需要在每个非聚集索引中进行相应的修改。请在决定要在哪些字段上创建聚集索引的时候牢记这点。最好在非易失性的字段上创建聚集索引。

如果行的移动是因为原来的分页不能再容纳这行数据。它依然会保持相同的行定位符(换而言之,该行数据的聚集键保持不变),并且没有非聚集索引需要被修改。

在索引内部机理的讨论中也了解了如果数据表上没有聚集索引(换而言之,仍然是堆表结构),那么存在非聚集索引中的行定位符实际上就是行的物理位置。在SQL Server 2005中,如果堆中的一行记录要移到新的分页上去,该记录会在原来的位置留下一个“前转指针”(forwarding pointer)。SQL Server无需改变非聚集索引,它们依旧指向原来的位置,并从原位出发指向新的位置。

下面来看一个例子。首先新建一张表,与之前演示插入操作的那张表十分相似,但是该表还有第三个变长字段。当向这张表插入五条数据以后,会填满这个分页,然后更新其中一行记录使第三个字段变得相当长。原始分页就无法再容纳这行数据,因此必须被移动。接着可以将dbcc ind的输出结果导入sp_table_pages数据表中,以得到该表所使用的分页数目。

use adventureworks;
GO

drop table bigrows;
GO

create table bigrows
(
a int identity,
b varchar(1600),
c varchar(1600)
);
GO

insert into bigrows values(replicate('a',1600),'');
insert into bigrows values(replicate('b',1600),'');
insert into bigrows values(replicate('c',1600),'');
insert into bigrows values(replicate('d',1600),'');
insert into bigrows values(replicate('e',1600),'');
GO

update bigrows set c=replicate('x',1600) where a=3;
GO

truncate table sp_table_pages;

insert into sp_table_pages exec('dbcc ind(adventureworks,bigrows,-1)');

select pagefid,pagepid from sp_table_pages where pagetype=1;

查看输出结果:

pagefid pagepid
------- -----------
1 20996
1 20997

use adventureworks;
GO
dbcc traceon(3604);
GO
dbcc page(adventureworks,1,20996,1)
PAGE: (1:20996)

输出结果如下:

BUFFER:

BUF @0x0000000083FD7F80

bpage = 0x00000000835FE000 bhash = 0x0000000000000000 bpageno = (1:20996)
bdbid = 6 breferences = 0 bUse1 = 42333
bstat = 0xc0010b blog = 0x2121bbbb bnext = 0x0000000000000000

PAGE HEADER:

Page @0x00000000835FE000

m_pageId = (1:20996) m_headerVersion = 1 m_type = 1
m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0x8
m_objId (AllocUnitId.idObj) = 349 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72057594060800000
Metadata: PartitionId = 72057594054508544 Metadata: IndexId = 0
Metadata: ObjectId = 823673982 m_prevPage = (0:0) m_nextPage = (0:0)
pminlen = 8 m_slotCnt = 5 m_freeCnt = 1617
m_freeData = 8180 m_reservedCnt = 1606 m_lsn = (134:664:13)
m_xactReserved = 1606 m_xdesId = (0:18215) m_ghostRecCnt = 0
m_tornBits = 0

Allocation Status

GAM (1:2) = ALLOCATED SGAM (1:3) = ALLOCATED
PFS (1:16176) = 0x63 MIXED_EXT ALLOCATED 95_PCT_FULL DIFF (1:6) = CHANGED
ML (1:7) = NOT MIN_LOGGED

DATA:

Slot 0, Offset 0x60, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x000000000E9DC060

0000000000000000: 30000800 01000000 0300f801 004f0661 ?0............O.a
0000000000000010: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000020: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000030: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000040: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000050: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000060: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000070: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000080: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000090: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000000F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000100: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000110: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000120: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000130: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000140: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000150: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000160: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000170: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000180: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000190: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000001F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000200: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000210: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000220: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000230: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000240: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000250: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000260: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000270: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000280: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000290: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000002F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000300: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000310: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000320: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000330: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000340: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000350: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000360: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000370: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000380: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000390: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000003F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000400: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000410: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000420: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000430: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000440: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000450: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000460: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000470: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000480: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000490: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000004F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000500: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000510: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000520: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000530: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000540: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000550: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000560: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000570: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000580: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000590: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005A0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005B0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005C0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005D0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005E0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
00000000000005F0: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000600: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000610: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000620: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000630: 61616161 61616161 61616161 61616161 ?aaaaaaaaaaaaaaaa
0000000000000640: 61616161 61616161 61616161 616161????aaaaaaaaaaaaaaa

Slot 1, Offset 0x6af, Length 1615, DumpStyle BYTE

Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x000000000E9DC6AF

0000000000000000: 30000800 02000000 0300f801 004f0662 ?0............O.b
0000000000000010: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000020: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000030: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000040: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000050: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000060: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000070: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000080: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000090: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000000F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000100: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000110: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000120: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000130: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000140: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000150: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000160: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000170: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000180: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000190: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000001F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000200: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000210: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000220: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000230: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000240: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000250: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000260: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000270: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000280: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000290: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000002F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000300: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000310: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000320: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000330: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000340: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000350: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000360: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000370: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000380: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000390: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000003F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000400: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000410: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000420: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000430: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000440: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000450: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000460: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000470: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000480: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000490: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000004F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000500: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000510: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000520: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000530: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000540: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000550: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000560: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000570: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000580: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000590: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005A0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005B0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005C0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005D0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005E0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
00000000000005F0: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000600: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000610: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000620: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000630: 62626262 62626262 62626262 62626262 ?bbbbbbbbbbbbbbbb
0000000000000640: 62626262 62626262 62626262 626262????bbbbbbbbbbbbbbb

a=3的记录所在槽2的内容如下:

Slot 2, Offset 0x1feb, Length 9, DumpStyle BYTE

Record Type = FORWARDING_STUB Record Attributes =
Memory Dump @0x000000000E9DDFEB

0000000000000000: 04055200 00010000 00?????????????????..R......

第一个字节的值为4(04)意味着这只是一个前转部分。后三个字节005205是记录移动的目的分页号。由于只是一个十六进制的值,需要将其转化成十进制值20997。下一组四个字节表明分页在文件号为1,槽号为0的地方。如果接着使用dbcc page来查看分页20997,可以看到前转记录的模样。

select CONVERT(bigint, CAST(0x005205 As varbinary));
--------------------
20997

(1 行受影响)

use adventureworks;
GO
dbcc traceon(3604);
GO
dbcc page(adventureworks,1,20997,1)

输出结果如下:

PAGE: (1:20997)

BUFFER:

BUF @0x0000000080FF9180

bpage = 0x0000000080E46000 bhash = 0x0000000000000000 bpageno = (1:20997)
bdbid = 6 breferences = 0 bUse1 = 44564
bstat = 0xc0010b blog = 0x12121bbb bnext = 0x0000000000000000

PAGE HEADER:

Page @0x0000000080E46000

m_pageId = (1:20997) m_headerVersion = 1 m_type = 1
m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0x8000
m_objId (AllocUnitId.idObj) = 349 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72057594060800000
Metadata: PartitionId = 72057594054508544 Metadata: IndexId = 0
Metadata: ObjectId = 823673982 m_prevPage = (0:0) m_nextPage = (0:0)
pminlen = 8 m_slotCnt = 1 m_freeCnt = 4865
m_freeData = 4952 m_reservedCnt = 0 m_lsn = (134:664:10)
m_xactReserved = 0 m_xdesId = (0:0) m_ghostRecCnt = 0
m_tornBits = 0

Allocation Status

GAM (1:2) = ALLOCATED SGAM (1:3) = ALLOCATED
PFS (1:16176) = 0x61 MIXED_EXT ALLOCATED 50_PCT_FULL DIFF (1:6) = CHANGED
ML (1:7) = NOT MIN_LOGGED

DATA:

Slot 0, Offset 0x6bb, Length 3229, DumpStyle BYTE

Record Type = FORWARDED_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS

Memory Dump @0x0000000010F1C6BB

0000000000000000: 32000800 03000000 0300f803 00530693 ?2............S..
0000000000000010: 0c9d8c63 63636363 63636363 63636363 ?...ccccccccccccc
0000000000000020: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000030: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000040: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000050: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000060: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000070: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000080: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000090: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000000F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000100: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000110: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000120: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000130: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000140: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000150: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000160: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000170: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000180: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000190: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000001F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000200: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000210: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000220: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000230: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000240: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000250: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000260: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000270: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000280: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000290: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000002F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000300: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000310: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000320: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000330: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000340: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000350: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000360: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000370: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000380: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000390: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000003F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000400: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000410: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000420: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000430: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000440: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000450: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000460: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000470: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000480: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000490: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000004F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000500: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000510: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000520: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000530: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000540: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000550: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000560: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000570: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000580: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000590: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005A0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005B0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005C0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005D0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005E0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
00000000000005F0: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000600: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000610: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000620: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000630: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000640: 63636363 63636363 63636363 63636363 ?cccccccccccccccc
0000000000000650: 63636378 78787878 78787878 78787878 ?cccxxxxxxxxxxxxx
0000000000000660: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000670: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000680: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000690: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000006A0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000006B0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000006C0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000006D0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000006E0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000006F0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000700: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000710: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000720: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000730: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000740: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000750: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000760: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000770: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000780: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000790: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000007A0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000007B0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000007C0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000007D0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000007E0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000007F0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000800: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000810: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000820: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000830: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000840: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000850: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000860: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000870: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000880: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000890: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000008A0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000008B0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000008C0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000008D0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000008E0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000008F0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000900: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000910: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000920: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000930: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000940: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000950: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000960: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000970: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000980: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000990: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000009A0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000009B0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000009C0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000009D0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000009E0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
00000000000009F0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000A00: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000A10: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000A20: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000A30: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000A40: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000A50: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000A60: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000A70: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000A80: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000A90: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000AA0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000AB0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000AC0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000AD0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000AE0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000AF0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000B00: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000B10: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000B20: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000B30: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000B40: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000B50: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000B60: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000B70: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000B80: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000B90: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000BA0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000BB0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000BC0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000BD0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000BE0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000BF0: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000C00: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000C10: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000C20: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000C30: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000C40: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000C50: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000C60: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000C70: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000C80: 78787878 78787878 78787878 78787878 ?xxxxxxxxxxxxxxxx
0000000000000C90: 78787800 04045200 00010002 00????????xxx...R......

OFFSET TABLE:

Row - Offset
0 (0x0) - 1723 (0x6bb)

前转指针
前转指针允许用户在堆中修改数据而无需担心对非聚集索引带来较严重的影响。如果一条已经被前转的记录必须再次移动,最初的前转指针就被更新并指向新的位置。如果还要继续移动,那么前转指针就会不断地指向另一个前转指针。另外,如果前转记录收缩到其原始位置足以能够容纳时,这条记录会被移回到原始位置,如果分页上还有可用空间的话,前转指针就会被删除。

SQL Server的后续版本可能会包括一些机制对堆表中的数据进行物理的重组,这将消除前转指针的作用。注意前转指针只存在于堆表中,并且alter table的重组选项对于堆表来说是不起作用的。可以对堆表上的非聚集索引进行碎片整理但是不能对表本身。目前来说,当前转指针创建完以后就永远呆在原地—除了个别例外情况。第一种例外已经提到过,行会收缩并返回其初始位置。第二种例外是数据库收缩时。当文件收缩时,SQL Server实际上会为书签进行再分配。收缩进程不会产生前转指针。对于因为收缩进程而被移除的分页来说,它们包含的任何前转指针或者残余部分实际上都处于“未前转”的状态。前转指针被移除的其他情况十分明显,譬如前转记录被删除或者在表上创建聚集索引从而使其不再是堆表结构。

Oracle Shared Pool Memory Management

Oracle在管理共享池内存方面面临着难以置信的挑战。多年来的所有改变、bug、补丁和各种性能问题都说明了这一点。虽然这可能会引起一些同情,但当面对与内存管理相关的棘手问题时,同情很快就会转化为愤怒。在本节中,我将解释如何管理共享池内存、多年来的管理进展、如何分配和释放内存、如何处理可能出现的4031错误,以及最后如何解决共享池锁存器争用。

From Hashing to Subpools
在Oracle 7和Oracle 8i中,共享池管理是在一种有趣的哈希结构帮助下执行的。如果还记得我们关于cache buffer 哈希链与library cache哈希链,那么这将非常有意义,但这里存在一种苦恼。当一个进程需要共享池中的内存时,它产生的哈希和链与所请求的内存大小相关。链也通常被称作heap,它是可用内存块链表。因此,从概念上讲,前几个链与大约1KB的内存块相关,后几个链与大约2KB的内存块相关,以此类推。虽然这确实很巧妙,但是经过一段时间对大小不一致的内存进行分配和释放之后,链实际上可以变成几千个节点长。请记住,哈希缓冲区链的大小平均在0到1之间。所以一个由几千个节点组成的链是巨大的。更糟的是,只有一个共享池latch锁来覆盖所有哈希链!清洗共享池帮助很大,因为链将减少到一个可观的规模。但这无法操作大型生产数据库,因此Oracle不得不进行更改。

Oracle9i引入了子池,这自然会导致多个共享池锁存器。基于哈希的策略被多个子池替换,每个子池包含一个在标准LRU策略上操作的堆。Oracle也开始标准化内存需求大小,这增加了找到可接受内存大小块的可能性。子池、多个共享池锁latch和LRU策略极大地减少了共享池内存管理问题。如果您同时管理过Oracle8i和Oracle9i系统,您可能会经历这种变化,并注意到有很大的不同。

数据库系统中共享池子池的数量可以通过查看实例参数_kghdsidx_count或通过计算x$kghlu视图中的行数来判断。

下面的查询显示了与共享池子池相关的一系列SQL语句。在这个例子中,一个大小为800MB的共享池存在三个子池。x$ksmss查询对于每个子池返回一行记录并且如果存在java pool还会另外加一行记录。设置子池数量的实例参数_kghdsidx_count不能被动态修改。如果你想影响Oracle调用一个子池号发生改变,你必须设置实例参数并回收实例。

SQL> @spspinfo
SQL> select sum(bytes/1024/1024) sp_size
2 from v$sgastat
3 where pool='shared pool';
SP Size (MB)
------------
         800
SQL> select count(*) no_sp from x$kghlu;
Num of SPs
----------
         4
SQL> select INST_ID, KSMDSIDX, KSMSSLEN
2 from x$ksmss
3 where ksmssnam='free memory';
INST_ID    KSMDSIDX   KSMSSLEN
---------- ---------- -----------
1          0          301989888
1          1          18818468
1          2          12659340
1          3          7697300
1          4          20482152
SQL> select i.ksppinm param,v.ksppstvl value
2 from x$ksppi i, x$ksppcv v
3 where v.indx=i.indx
4 and v.inst_id=i.inst_id
5 and i.ksppinm='_kghdsidx_count';
PARAM                VALUE
-------------------- -----
_kghdsidx_count      4

Oracle对子池的数量设置了严格的限制。在Oracle 11g中,可以使用7个共享池子池来启动实例,但有8个子池,该实例没有启动——实际上,在重新启动之前需要关闭实例。

有趣的是,Oracle不必遵从子池号的意愿。实际上,在一个类似于上面查询结果的Oracle数据库11.1g的示例中,实例参数被设置为2,实例重新启动,但是Oracle创建了三个子池。在Oracle数据库11.2g中,实例参数再次被设置为2,实例重新启动,并且按照指定的Oracle创建了两个子池。在没有手动设置实例参数的情况下运行Oracle数据库11.1g和11.2g, Oracle只创建了一个子池。因此,尽管你可以影响甲骨文,它仍然保留做出改变的权利。

内存分配与回收
内存分配是相当简单的。它遵循标准的LRU算法并与pinning与locking一起使用。当一个Oracle进程(服务器或后台进程)请求内存时,Oracle内核中的一部分称作为heap manager(堆管理器)的会被执行。虽然细节不断变化,但概念算法基本相同。

Oracle进程需要特定数量的内存,这些内存被转换为多个特定大小内存块的请求。堆管理器搜索与每个请求匹配的单个大小的内存块。多个内存块(认为是非连续的)是不行的。如果进程请求4KB内存,堆管理器必须从共享池内存中返回4KB内存块的地址。

在Oracle9i中,Oracle进程获得子池latch,并将在放弃之前搜索子池至多5次。因为内存的情况可能会发生急剧且快速的变化,允许多次传递会增加找到内存的可能性。然而在五次搜索之后,当持有各自共享池latch时,如果合适的大小的内存块没有找到,Oracle将会放弃,并posts错误代码4031,“out of mmemory”信息,并且会话将会停止处理。对于每个Oracle DBA来说,这在生产系统中将是不可接受的。

在Oracle Database 10g中,Oracle进程对内存的要求更加强烈。如果在五次搜索之后在当前共享池中没有找到合适的内存,进程将移动到另一个子池。这一过程将继续进行到所有定义的子池被搜索完为止。如果在这时,没有找到合适的内存,就像以前一样,Oracle将会放弃并posts 4031错误并且停止处理。Oracle在这个版本中所做的是消耗更多CPU和更长时间地持有共享池latch来减少返回错误消息的机会。从数据库操作的角度来看,性能较慢总比没有性能好。在我们解决性能问题时,至少可以执行工作。

当内存不足时,Oracle将回收不被频繁访问的内存块。可能在尝试检索SQL语句的文本时遇到过这种情况,并且它不再缓存在共享池中。幸运地是,Oracle不会回收内存供其它对象使用。例如,如果一个游标被pinned(固定)了,Oracle将不会回收相关的内存,不管该内存是不是被频繁访问。事实上,即使清除共享池也不会删除被固定的游标。如果真的想清空共享池并且想从头开始,可以重启实例。

共享池latch竞争识别与解决
共享池latch被用来序列化共享池内存的管理。这意味着像搜索内存,LRU活动,分配内存与回收内存请求共享池latch这样的操作。因为从Oracle 9i开始存在多个子池,并且每个子池有它自己的共享池latch,只要使用这个版本或之后的版本就可以大大减少共享池lat这个特别的解决方案非常简洁,因为它只需要很少的工作,而且我们不是在玩弄Oracle的共享池LRU算法。但是,请记住,更多的子池可能需要更多的共享池内存,需要重新启动实例才能使实例参数更改生效,Oracle保留不尊重您的建议的权利ch竞争的可能性。但有些时候这些仍然不够。下面有些方案可能减少latch获取时间latch持有时间或者两者都减少。

固定大且频繁使用的对象
此策略用来确保对象成功进入缓存,不用管内存活动或对象大小。任何包第一次被调用时,整个包被加载到内存中。操作中在激活共享池后如果需要触发,将强制执行大量的内存管理活动,这将导致对象不能被加载而触发4031错误。即使如果对象被成功加载,用户可能会注意到应用程序的延迟。

有些时候可能想要固定小对象。例如,假设一个对象有一种高强度活动模式,长时间的暂停导致对象的内存被释放,然后是另一段高强度活动。为了确保没有应用程序延迟且为了减少内存管理,我们可以简单固定对象。

大多数大型Oracle应用程序都提供一个脚本,其中包含要固定在共享池中的对象,并且它们将建议在实例启动后立即运行该脚本。重要的是要知道,即使您的应用程序供应商提供了这样一个列表,您也可以通过了解您的组织实际使用对象的方式来细化这个列表。供应商应用程序开发人员通常会创建固定列表。然而大多数应用程序开发商认为他们的对象是最重要的并且应该总是被固定。但实际上,很多时候,在应用程序在生产环境中运行之前,没有人真正知道您的组织将如何使用它。因此如果出现4031错误,这对于修改固定列表来说是一个好消息。

想要确保对象总是固定在共享池中有四个简单步骤要操作。关键词pin常被使用,dbms_shared_pool包的keep函数被用来确保对象保留在共享池中。缺省情况下当创建数据库时这个包不会被加载,因此第一步就是要加载它。下面的代码就是用来创建这个过程。

[oracle@jytest1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Mon May 6 14:30:28 2019

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> @$ORACLE_HOME/rdbms/admin/dbmspool.sql

Session altered.


Package created.


Grant succeeded.


Session altered.

下一步骤是找到大的或频繁的对象。Oracle保持对共享池对象使用进行跟踪并且可以通过v$db_object_cache视图来查看这些信息。下面是使用OSM脚本dboc.sql来识别潜在的对象。您可能会看到一组比其他包大得多的包,以及执行得比其他包频繁得多的包。还可能有一些对象,您个人知道它们具有不同寻常的执行配置文件,而您希望缓存它们。

一旦有了要保存的对象列表,下一步就是确定如何将它们放入缓存中。keep函数用于固定对象,或者更好地说,用于将对象保存在共享池中。

SQL> @dboc 10 20
old   9: where  a.sharable_mem >= &min_size
new   9: where  a.sharable_mem >= 20
old  10:   and  a.executions >= &min_exec
new  10:   and  a.executions >= 10

DB/Inst: jy/jy2                                                   07-May 08:26am
Report:   dboc.sql             OSM by OraPub, Inc.                Page         1
                      Oracle Database Object Cache Summary

                                                 Obj          Exe  Size
Owner        Obj Name                            Type Loads   (k)  (KB) Kept?
------------ ----------------------------------- ---- ----- ----- ----- -----
SYS          DBMS_STATS_INTERNAL                 PBDY     0    32   492 NO
SYS          PLITBLM                             PKG      0     8     8 NO
SYS          DBMS_ASSERT                         PBDY     0     6    16 NO
SYS          STANDARD                            PBDY     0     3    32 NO
SYS          DBMS_STATS_INTERNAL                 PKG      0     1   122 NO
SYS          DBMS_SQLDIAG                        PBDY     0     1    40 NO
SYS          DBMS_SQLTUNE_UTIL0                  PBDY     0     1    16 NO
SYS          DBMS_AUTO_TASK                      PBDY     0     0    24 NO
SYS          DBMS_AUTO_TASK                      PKG      0     0    28 NO
SYS          DBMS_STANDARD                       PKG      0     0    44 NO
SYS          DBMS_ADVISOR                        PBDY     0     0    69 NO
SYS          DBMS_SQLTUNE_UTIL2                  PBDY     0     0    20 NO
SYS          DBMS_UTILITY                        PKG      0     0    12 NO
SYS          PRVT_ADVISOR                        PBDY     0     0   176 NO
SYS          DBMS_SQLTUNE_UTIL1                  PBDY     0     0    57 NO
SYS          DBMS_STATS_ADVISOR                  PBDY     0     0   167 NO
SYS          DBMS_SYS_ERROR                      PBDY     0     0     8 NO
SYS          DBMS_OUTPUT                         PBDY     0     0    12 NO
SYS          DBMS_UTILITY                        PBDY     0     0    57 NO
SYS          DBMS_PDB                            PBDY     0     0    12 NO
SYS          DBMS_STATS_ADVISOR                  PKG      0     0    24 NO
SYS          DBMS_SQLTUNE_INTERNAL               PBDY     0     0   532 NO

22 rows selected.


SQL> l
  1  select a.owner ownerx,
  2         a.name  namex,
  3         decode(a.type,'PACKAGE','PKG','PACKAGE BODY','PBDY','FUNCTION','FNC','PROCEDURE','PRC') typex,
  4         a.loads/1000 loadsx,
  5         a.executions/1000 execsx,
  6         a.sharable_mem/1024 sizex,
  7         a.kept keptx
  8  from   v$db_object_cache a
  9  where  a.sharable_mem >= &min_size
 10    and  a.executions >= &min_exec
 11    and  a.type in ('PACKAGE','PACKAGE BODY','FUNCTION','PROCEDURE')
 12* order by executions desc, sharable_mem desc, name

为了将一个游标保存在共享池中,从v$sql,v$sqlarea或者v$open_cursor中收集它的地址与哈希值。下面的代码显示地址(6877c238)和哈希值(1356456286)在它们之间使用逗号进行连接作为一个参数输入,第二个参数是C,因为我们要保存一个游标。对于保存触发器参数为T,对于序列,使用Q,对于包,过程与函数,参数为P。

SQL> exec dbms_shared_pool.keep('6877C238,1356456286','C');
PL/SQL procedure successfully completed.

上面的代码片段可以用于编程结构,但是大多数人发现下面的选项最容易使用。下面的代码用来保存jy方案中的TuoMi过程。

SQL> exec dbms_shared_pool.keep('jy.TuoMi');

PL/SQL procedure successfully completed.

最后,在发出上述代码片段之后,您可以轻松地进行检查,以确保确实保存了对象。从下面的输出结果可以看到jy.TUOMI过程对象的Kept列被设置为YES。

SQL> @dboc 0 0
old   9: where  a.sharable_mem >= &min_size
new   9: where  a.sharable_mem >= 0
old  10:   and  a.executions >= &min_exec
new  10:   and  a.executions >= 0

DB/Inst: jy/jy2                                                   07-May 08:48am
Report:   dboc.sql             OSM by OraPub, Inc.                Page         1
                      Oracle Database Object Cache Summary

                                                 Obj          Exe  Size
Owner        Obj Name                            Type Loads   (k)  (KB) Kept?
------------ ----------------------------------- ---- ----- ----- ----- -----
SYS          DBMS_STATS_INTERNAL                 PBDY     0    32   492 NO
SYS          PLITBLM                             PKG      0     8     8 NO
SYS          DBMS_ASSERT                         PBDY     0     6    16 NO
..............
SYS          DBMS_SQLTUNE_INTERNAL               PKG      0     0    71 NO
JY           TUOMI                               PRC      0     0    36 YES
SYS          DBMS_SMB_INTERNAL                   PBDY     0     0    32 NO
SYS          DBMS_SQLTUNE                        PKG      0     0    32 NO
..............
99 rows selected.

经常有人问我,多长时间修改一次固定列表。就我个人而言,除非有很好的理由,否则我不喜欢调用任何数据库更改。改进固定列表的一个很好的理由是,如果系统突然开始出现共享池latch争用,或者遇到4031个错误。这一点非常重要:如果添加了应用程序功能、发生了应用程序升级或应用程序使用发生了显著变化,则从更主动的角度细化固定列表。

清空共享池
虽然不在任何列表的最上面,但是只要刷新共享池就可以立即缓解共享池latch争用。对于oracle9i之前的系统尤其如此,那时还不存在子池。这很明显不是一个最优解决方案,因为每个对象都没有固定在共享池中将被删除并且它们的内存会被回收。初始结果可能会适得其反,因为它可能会导致立即进行大量的硬解析,正如我们所知,这会消耗大量CPU资源,并强制执行非自然数量的锁。然而,这种不幸的情况很快就会平息下来。

有时,共享池大小的组合,数据库版本(Oracle 9i)与应用程序的使用将使DBA别无选择,只能计划定期共享池刷新。这就是现实情况。

如下面的代码片段所示,刷新共享池非常简单,但效果确实显著

SQL> alter system flush shared_pool;

System altered.

增加子池数量
最简单、最强大和最合适的共享池latch解决方案之一是简单地添加子池,增加子池也将增加共享池latch。前面的“从哈希到子池”小节详细介绍了这个过程。这个特别的解决方案非常简洁,因为它只需要很少的工作,而且我们不是在玩弄Oracle的共享池LRU算法。但是,请记住,更多的子池可能需要更多的共享池内存,需要重新启动实例才能使实例参数更改生效,Oracle保留不尊重您的建议的权利。

减少共享池大小
这听起来可能很奇怪,在子池存在之前,增加共享池大小最终可能导致共享池latch争用。每一种算法的性能都是有限的,都是针对特定情况而设计的。当情况发生变化时,算法可能无法按预期执行。不要忘记,增加缓存来支持更多的活动几乎总是需要更多的CPU资源来管理。因此,可能会有一个收益递减点。Oracle最初的共享池内存管理算法在大约600MB的共享池中运行得相当好,但是当它达到750MB左右时,dba开始看到大量的共享池latch争用是非常常见的。一旦引入了子池,特别是与我概述的其他解决方案相结合,共享池latch争用就可以成功地解决。

4031错误解决方案
Oracle在决定什么时候放弃,什么时候继续使用CPU和保持latches之间有一个微妙的平衡。多年来,Oracle耗尽共享池内存的可能性已经降低,但是4031错误的几率仍然高度依赖于Oracle共享池内存的数量和应用程序。下面是一个实际的4031错误消息

ORA-04031: unable to allocate 4192 bytes of shared memory ("shared
pool","SELECT * F...","sql area (6,0)","kafco :
qkacol"):4031:375:2008:ocicon.c

上面的信息显示,4KB内存正尝试在子池6中进行分配,但是由于某些原因,不能完成分配。幸运地是有一些方法来减少收到4031错误的机会。

清空共享池
与解决共享池latch争用一样,4031错误的一个解决方案也是清空共享池。虽然没有DBA愿意承认定期清空共享池,但这仍然有效。根据Oracle版本、分配的共享池内存的数量以及应用程序独特的内存使用模式,这可能是您的最佳选择。对于oracle 9i之前的系统尤其如此。

增加共享池大小
从概念上讲,增加共享池内存为Oracle提供了更大的灵活性来满足内存请求。然而,除了好处之外,在转移计算资源时也总是有成本的。在大多数情况下,收益实际上大于成本,因此,如果操作系统有可用内存,或者可以将内存从其他Oracle缓存转移到共享池,增加共享池内存很可能减少4031个错误。

请记住,每当您要求Oracle管理更多内存时,都需要更多的CPU来管理这些内存。在oracle9i之前的系统中尤其如此,因为可能存在非常长的内存链堆。如果链有数千个块长,而4031个错误可能会消失,那么在试图获取共享池latch和扫描长链时,这种情况可能会表现为严重的共享池latch争用和大量CPU消耗——所以要小心。

如Oracle文档所述,如果您通过自动内存管理获得解放,您可能需要设置最小的共享池大小。在增加缓冲区缓存的过程中,Oracle会自动减少共享池的大小,以至于开始出现4031个错误。

增加共享池保留大小
当一个较大的包最初被加载到一个已经非常活跃的共享池中时,就会出现一个常见的内存分配挑战。共享池越活跃,特别是当它很小并且对象大小非常不同时,就越有可能找不到所需的内存。

假设我们的服务器进程需要内存来存储一个大游标。当Oracle搜索共享池内存时,如果对象大小大于阈值,Oracle首先搜索保留区域。如果在保留区域中没有找到内存,Oracle将到非保留区域搜索。这种策略有助于将较小的对象排除在保留区域之外,从而将其保留给较大的对象。

有三个实例参数可以组合使用:
.shared_pool_reserved_size被用来直接设置共享池保留大小以字节为单位
.隐藏参数_shared_pool_reserved_pct,它的缺省值为5(5%),可以被用来代替shared_pool_reserved_size。
.一个相对大的对象是由实例参数_shared_pool_reserved_min_alloc来定义的,它的缺省值为4400字节。有趣的是缺省值4400字节仅仅比常见的单个块请求4096字节大。因此,在默认情况下,Oracle表示任何大于一个典型大小的内存块请求都被认为是大的,因此应该从保留的大小中获得内存。

前两个参数中的任何一个都可以用来为相对较大的对象设置共享池保留内存大小。如果您设置其中一个参数,Oracle将计算另一个参数。通过仔细调整这些参数,性能分析人员可以增加进程找到大量内存的可能性,同时仍然维护大量内存给相对较小对象使用。虽然这些参数通常不会调整,但如果发生4031错误,它们的小心调整可能会修复问题。

最小化游标固定时间
当执行游标时,游标也被固定。毕竟,您不希望SQL语句在执行期间突然消失!这是好消息。潜在的坏消息是,当执行完成时,固定游标被释放。如果没有其他进程固定游标,Oracle可以随意销毁,即释放关联的内存。现在假设有人想重新执行游标。如果它已被释放,将执行硬解析,因为整个游标将被重建!每个应用程序使用模式都是独特的;因此,当与更小的共享池或许多独特的SQL语句(或者两者都有)结合使用时,内存管理和库缓存活动可能会变得异常紧张。减少硬解析的一种方法是固定游标,使它们不能被释放。

Oracle提供了一个特殊的实例参数,该参数将保持所有会话的所有游标固定到关闭游标为止。但是,这种好处是以增加共享池内存消耗为代价的,因此,增加了接收4031错误的可能性。Oracle非常清楚这一点,所以为了鼓励回收释放内存并降低发生4031个错误的可能性,cursor_space_for_time实例参数默认设置为false。

如果系统正经历4031错误,你应该要检查cursor_space_for_time参数值。如果你的系统在过去某个时间点已经经历了严重的共享池latch急用,那么可以理解有人将cursor_space_for_time设置为true了。虽然你可能不会决定设置cursor_space_for_time参数为false。但这是一个有效选项应该被考虑。

减小保留对象的内存消耗
如果有太多对象通过执行dbms_shared_pool.keep过程被强制保留在共享池中,它们可能会消耗大量的内存Oracle可能无法成功地管理剩下的内存。此外,如果没有将大型对象保存在共享池中,则实例已经运行了一段时间,然后引用该对象,当强制加载该对象时,内存可能不可用。关键是不要随意地将对象保存在共享池中。

升级数据库版本到10gr2
当然,4031个错误不是升级的惟一原因,而是从Oracle数据库10gr2开始将内存标准化为4KB块。虽然我永远不会仅仅因为这个改进就建议升级到这个版本,但是这可能是升级的一部分原因。

就像对段区大小进行标准化一样,拥有标准的内存块大小可以提高快速找到合适内存的可能性。可以找到的内存越快,消耗的CPU周期就越少,必须持有共享池latch的时间就越短,存在大量浪费的小内存块的可能性就越小(增加4031错误的可能性)。

Oracle Library cache

Library cache
在提出好的库缓存性能解决方案之前,您需要对库缓存的体系结构有一个充分的了解。有了这些知识,以及前几章介绍的背景知识,您就能够理解为什么一个解决方案是有意义的,以及它可能产生的影响。

Library Cache架构
library cache架构是非常复杂的。并发性、对象之间的关系和快速搜索的组合需求确实会对体系结构造成压力。我将从这个体系结构的一个非常概念性的层次开始,然后有条不紊地深入到越来越多的细节。当细节对性能救火没有特别帮助时,我将停止。

一个很好的library cache模型是传统library。假设你想找雷·布拉德伯里的书《蒲公英酒》。因为图书馆是一个巨大的图书仓库(想想所有的缓存对象),顺序或随机搜索都是徒劳的。因此,您进入卡片目录区域(哈希结构),并直接访问包含以字母A到D开头的作者的书籍的卡片目录(考虑哈希到一个特定的桶)。在你前面有人排队,因此你必须等待(这就好比获取相关哈希桶的latch一样)。最后你站在了适当的卡片目录前面(就好像你获得了latch)并开始序列化搜索图书(就好像序列化搜索一个哈希chain)。最终你找到了卡片并看到了图书的地址为813.54(就好像library cache handle)。你走到图书应该存放的位置,找到它并开始阅读(就好像访问游标一样)。如果您能够在脑海中描绘这个故事,那么您就已经很好地理解了Oracle的库缓存。

Library Cache Conceptual Model
与buffer cache一样,library cache对象使用一种哈希结构来进行定位。这将调用哈希函数,桶,链表与latches或mutexes。一个关键的不同点是哈希链节点不是由buffer headers组成的,而是称为句柄(handles)的简单指针节点。

句柄是内存地址指针的常用术语,这就是library cache的情况。在一个handle与一个library cache内存对象之间是一对一的关系。所以引用句柄与引用它的关联对象是同义词操作。当mutexes被用来替代library cache latches时,每个单独的handle都有一个相关的mutex。每个library cache对象引用一个特定类型的对象,有时叫命名空间,比如一个游标,一个子游标,一个表或一个程序结构。

下图抽象了library cache对mutexes的实现以及突显了各种架构组件但没有指定对象名称。Library cache对象使用一种哈希结构来进行搜索,因此可以看到桶,比如bucket BKT200。当实同mutexes时,对于每个handle都有一个相关的mutex,因此每个内存chunk有一个相关的mutex。每个哈希链可能包含零个或多个handles,它与零个或多个library cache对象相关,比如游标 CSR500与表TBL 400。每个父游标将至少有一个子游标。一个父游标比如CSR 500可以与多个子游标,比如CCSR 600和CCSR 610相关联。

一种关键的library cache特点就是对象关系。在上图中,注意表TBL 400与三个子游标CCSR 600,CCSR 610和CCSR 620相关联,如果表TBL 400被修改,Oracle知道那些library cache对象将会失效。例如,如果表TBL 400被修改了并且Oracle认为这种修改非常严重足以使用library cache条目失效,然后所有相关的library cache对象也将失效。当然,必须维护序列化,这样您就可以看到,即使是相对较小的库缓存也会变得非常紧张。

使用mutexes代替latches的影响。因此一个mutex与每个library cache对象相关联,因此不会使整个哈希链不可用,从而显著减少了错误争用和获取CPU消耗,从而提高了响应时间。

Library Cache Object References
现在,让我们将概念模型提升到更实际的层次,以阐明库缓存对象关系。

SQL> oradebug setmypid
Statement processed.
SQL> alter session set MAX_DUMP_FILE_SIZE=unlimited;

Session altered.

SQL> create table findme as select * from dual;

Table created.

SQL> alter session set optimizer_mode = all_rows;

Session altered.

SQL> select * from findme;

D
-
X

SQL> alter session set optimizer_mode = first_rows;

Session altered.

SQL> select * from findme;

D
-
X

SQL> select dummy from findme;

D
-
X

SQL> alter session set events 'immediate trace name library_cache level 10';

Session altered.

SQL> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/jy/jy1/trace/jy1_ora_13777.trc

从跟踪文件中可以看到Bucket 12771与一个对象相关联,表findme的handle为0x8501f820,Bucket 14778相关的handle,mutex,名称和两个子游标。

Bucket: #=12771 Mutex=0xc5b46150(3298534883328, 31, 0, 6)
  LibraryHandle:  Address=0x8501f820 Hash=7c1631e3 LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
    ObjectName:  Name=CDB$ROOT.SYS.FINDME
      FullHashValue=29918f78d6b184afaf81fd2b7c1631e3 Namespace=TABLE/PROCEDURE(01) Type=TABLE(02) ContainerId=1 ContainerUid=1 Identifier=246951 OwnerIdn=0
    Statistics:  InvalidationCount=0 ExecutionCount=0 LoadCount=1 ActiveLocks=0 TotalLockCount=9 TotalPinCount=9
    Counters:  BrokenCount=2 RevocablePointer=2 KeepDependency=0 Version=0 BucketInUse=6 HandleInUse=6 HandleReferenceCount=0
    Concurrency:  DependencyMutex=0x8501f8d0(0, 4, 0, 0) Mutex=0x8501f970(768, 96, 0, 6)
    Flags=PIN/TIM/[00002801] Flags2=[0000]
    WaitersLists:
      Lock=0x8501f8b0[0x8501f8b0,0x8501f8b0]
      Pin=0x8501f890[0x8501f890,0x8501f890]
      LoadLock=0x8501f908[0x8501f908,0x8501f908]
    Timestamp:  Current=04-23-2019 09:19:22
    HandleReference:  Address=0x8501fa18 Handle=0xcff01220 Flags=OWN[200]
    LockInstance:  id='LB29918f78d6b184af' GlobalEnqueue=(nil) ReleaseCount=0
    PinInstance:  id='NB29918f78d6b184af' GlobalEnqueue=(nil)
    ReferenceList:
      Reference:  Address=0x7f4fa5f0 Handle=0x7f72fd58 Flags=DEP[01]
        Timestamp=04-23-2019 09:19:22 InvalidatedFrom=0
      Reference:  Address=0xbcc24930 Handle=0xd6d3f620 Flags=DEP[01]
        Timestamp=04-23-2019 09:19:22 InvalidatedFrom=0
      Reference:  Address=0xddfa2a28 Handle=0x7fb24eb8 Flags=DEP[01]
        Timestamp=04-23-2019 09:19:22 InvalidatedFrom=0
      Reference:  Address=0x800e41e8 Handle=0x83a9c4e8 Flags=DEP[01]
        Timestamp=04-23-2019 09:19:22 InvalidatedFrom=0
    LibraryObject:  Address=0xdf389690 HeapMask=0000-0701-0001-0000 Flags=EXS/LOC[0004] Flags2=[8000000] PublicFlags=[0000]
      DataBlocks:
        Block:  #='0' name=KGLH0^7c1631e3 pins=0 Change=NONE
          Heap=0xb387c0e8 Pointer=0xdf389760 Extent=0xdf3895e8 Flags=I/-/-/A/-/-/-
          FreedLocation=0 Alloc=1.304688 Size=3.976562 LoadTime=4629524905
        Block:  #='8' name=KGLS^7c1631e3 pins=0 Change=NONE
          Heap=0xdf389b18 Pointer=0xdb10a550 Extent=0xdb109870 Flags=I/-/-/A/-/-/-
          FreedLocation=0 Alloc=1.125000 Size=3.976562 LoadTime=0






Bucket: #=14778 Mutex=0xc5b59ae8(3298534883328, 43, 0, 6)
  LibraryHandle:  Address=0x818b62f8 Hash=ebf439ba LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
    ObjectName:  Name=select * from findme
      FullHashValue=57c14570e98dc8b98fe8a5a2ebf439ba Namespace=SQL AREA(00) Type=CURSOR(00) ContainerId=1 ContainerUid=1 Identifier=3958651322 OwnerIdn=0
    Statistics:  InvalidationCount=0 ExecutionCount=2 LoadCount=3 ActiveLocks=0 TotalLockCount=2 TotalPinCount=1
    Counters:  BrokenCount=1 RevocablePointer=1 KeepDependency=2 Version=0 BucketInUse=1 HandleInUse=1 HandleReferenceCount=0
    Concurrency:  DependencyMutex=0x818b63a8(0, 2, 0, 0) Mutex=0x818b6448(768, 37, 0, 6)
    Flags=RON/PIN/TIM/PN0/DBN/[10012841] Flags2=[0000]
    WaitersLists:
      Lock=0x818b6388[0x818b6388,0x818b6388]
      Pin=0x818b6368[0x818b6368,0x818b6368]
      LoadLock=0x818b63e0[0x818b63e0,0x818b63e0]
    Timestamp:  Current=04-23-2019 09:19:37
    HandleReference:  Address=0x818b64d0 Handle=(nil) Flags=[00]
    ReferenceList:
      Reference:  Address=0x8031bbf0 Handle=0x8054ae68 Flags=ROD[21]
      Reference:  Address=0x80f11e30 Handle=0xdd9f6df8 Flags=ROD[21]
    LibraryObject:  Address=0x84edddb0 HeapMask=0000-0001-0001-0000 Flags=EXS[0000] Flags2=[0000] PublicFlags=[0000]
      DataBlocks:
        Block:  #='0' name=KGLH0^ebf439ba pins=0 Change=NONE
          Heap=0xd2f65218 Pointer=0x84edde80 Extent=0x84eddd08 Flags=I/-/P/A/-/-/-
          FreedLocation=0 Alloc=3.390625 Size=3.976562 LoadTime=4629539589
      ChildTable:  size='16'
        Child:  id='0' Table=0x84edec30 Reference=0x84ede700 Handle=0x83a9c4e8
        Child:  id='1' Table=0x84edec30 Reference=0x84edea50 Handle=0xd6d3f620
    NamespaceDump:
      Parent Cursor:  sql_id=8zu55nbpz8fdu parent=0x84edde80 maxchild=2 plk=n ppn=n prsfcnt=0 obscnt=0
        CursorDiagnosticsNodes:
          ChildNode:  ChildNumber=0 ID=3 reason=Optimizer mismatch(10) size=3x4 optimizer_mode_hinted_cursor=0 optimizer_mode_cursor=1 optimizer_mode_current=2



Bucket: #=67700 Mutex=0xc5d5e7f8(3298534883328, 125, 0, 6)
  LibraryHandle:  Address=0xbd8f26d0 Hash=93850874 LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
    ObjectName:  Name=select dummy from findme
      FullHashValue=70b1c44268eb8c9d2860b06f93850874 Namespace=SQL AREA(00) Type=CURSOR(00) ContainerId=1 ContainerUid=1 Identifier=2474969204 OwnerIdn=0
    Statistics:  InvalidationCount=0 ExecutionCount=1 LoadCount=2 ActiveLocks=0 TotalLockCount=1 TotalPinCount=1
    Counters:  BrokenCount=1 RevocablePointer=1 KeepDependency=1 Version=0 BucketInUse=0 HandleInUse=0 HandleReferenceCount=0
    Concurrency:  DependencyMutex=0xbd8f2780(0, 1, 0, 0) Mutex=0xbd8f2820(768, 23, 0, 6)
    Flags=RON/PIN/TIM/PN0/DBN/[10012841] Flags2=[0000]
    WaitersLists:
      Lock=0xbd8f2760[0xbd8f2760,0xbd8f2760]
      Pin=0xbd8f2740[0xbd8f2740,0xbd8f2740]
      LoadLock=0xbd8f27b8[0xbd8f27b8,0xbd8f27b8]
    Timestamp:  Current=04-23-2019 09:20:01
    HandleReference:  Address=0xbd8f28b0 Handle=(nil) Flags=[00]
    ReferenceList:
      Reference:  Address=0x8574abf8 Handle=0x7f4cc5c0 Flags=ROD[21]
    LibraryObject:  Address=0x86991c70 HeapMask=0000-0001-0001-0000 Flags=EXS[0000] Flags2=[0000] PublicFlags=[0000]
      DataBlocks:
        Block:  #='0' name=KGLH0^93850874 pins=0 Change=NONE
          Heap=0xbc1721d8 Pointer=0x86991d40 Extent=0x86991bc8 Flags=I/-/P/A/-/-/-
          FreedLocation=0 Alloc=2.546875 Size=3.976562 LoadTime=4629563404
      ChildTable:  size='16'
        Child:  id='0' Table=0x86992af0 Reference=0x869925c0 Handle=0x7f72fd58
    NamespaceDump:
      Parent Cursor:  sql_id=2hs5hdy9sa23n parent=0x86991d40 maxchild=1 plk=n ppn=n prsfcnt=0 obscnt=0

从下面的内容可以看出子游标之间的关系。

Bucket: #=103006 Mutex=0xc5eb7488(3298534883328, 304, 0, 6)
  LibraryHandle:  Address=0xdd9f6df8 Hash=2ab9925e LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
    ObjectName:  Name=CDB$ROOT.57c14570e98dc8b98fe8a5a2ebf439ba Child:0
      FullHashValue=2ccbd3fc5f92a1798e3cc3a22ab9925e Namespace=SQL AREA STATS(75) Type=CURSOR STATS(102) ContainerId=1 ContainerUid=1 Identifier=716804702 OwnerIdn=0
    Statistics:  InvalidationCount=0 ExecutionCount=0 LoadCount=1 ActiveLocks=0 TotalLockCount=1 TotalPinCount=1
    Counters:  BrokenCount=1 RevocablePointer=1 KeepDependency=1 Version=0 BucketInUse=0 HandleInUse=0 HandleReferenceCount=0
    Concurrency:  DependencyMutex=0xdd9f6ea8(0, 1, 0, 0) Mutex=0xdd9f6f48(768, 9, 0, 6)
    Flags=RON/PIN/TIM/KEP/KPR/[00012805] Flags2=[0000]
    WaitersLists:
      Lock=0xdd9f6e88[0xdd9f6e88,0xdd9f6e88]
      Pin=0xdd9f6e68[0xdd9f6e68,0xdd9f6e68]
      LoadLock=0xdd9f6ee0[0xdd9f6ee0,0xdd9f6ee0]
    Timestamp:  Current=04-23-2019 09:19:37
    ReferenceList:
      Reference:  Address=0x800e40e0 Handle=0x83a9c4e8 Flags=ROD/KPP[61]
    LibraryObject:  Address=0x80f119f0 HeapMask=0001-0001-0001-0000 Flags=EXS[0000] Flags2=[0000] PublicFlags=[0000]
      ReadOnlyDependencies:  count='1' size='16'
        ReadDependency:  num='0' Table=0x80f12898 Reference=0x80f11e30 Handle=0x818b62f8 HandleFlag=0x10012841 RefFlags=DEP/ROD[21]
      DataBlocks:
        Block:  #='0' name=KGLH0^2ab9925e pins=0 Change=NONE
          Heap=0xd2468460 Pointer=0x80f11ac0 Extent=0x80f11948 Flags=I/-/P/A/-/-/-
          FreedLocation=0 Alloc=1.265625 Size=3.976562 LoadTime=4629539590
    NamespaceDump:
      STATS:  phd=0x818b62f8 chd=0x83a9c4e8 planhsh=5111da46 flg=1 Parse Count=1 Disk Reads=2 Disk Writes (Direct)=0 Disk Reads (Direct)=0 Physical read requests=2 Physical read bytes=16384 Physical write requests=0 Physical write bytes=0 IO Interconnect bytes=16384 Buffer Gets=27 Rows Processed=1 Serializable Aborts=0 Fetches=2 Execution count=1 PX Server Execution Count=0 Full Execution Count=1 CPU time=15000 Elapsed time=433961 Avg Hard Parse Time=420034 Application time=0 Concurrency time=985 Cluster/RAC time=496 User I/O time=407471 Plsql Interpretor time=0 JVM time=0 Sorts=0


Bucket: #=128596 Mutex=0xc5fb12f8(3298534883328, 137, 0, 6)
  LibraryHandle:  Address=0x8054ae68 Hash=efe9f654 LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
    ObjectName:  Name=CDB$ROOT.57c14570e98dc8b98fe8a5a2ebf439ba Child:1
      FullHashValue=35e6477c4d445fa62356ff83efe9f654 Namespace=SQL AREA STATS(75) Type=CURSOR STATS(102) ContainerId=1 ContainerUid=1 Identifier=4025087572 OwnerIdn=0
    Statistics:  InvalidationCount=0 ExecutionCount=0 LoadCount=1 ActiveLocks=0 TotalLockCount=1 TotalPinCount=1
    Counters:  BrokenCount=1 RevocablePointer=1 KeepDependency=1 Version=0 BucketInUse=0 HandleInUse=0 HandleReferenceCount=0
    Concurrency:  DependencyMutex=0x8054af18(0, 1, 0, 0) Mutex=0x8054afb8(768, 9, 0, 6)
    Flags=RON/PIN/TIM/KEP/KPR/[00012805] Flags2=[0000]
    WaitersLists:
      Lock=0x8054aef8[0x8054aef8,0x8054aef8]
      Pin=0x8054aed8[0x8054aed8,0x8054aed8]
      LoadLock=0x8054af50[0x8054af50,0x8054af50]
    Timestamp:  Current=04-23-2019 09:19:53
    ReferenceList:
      Reference:  Address=0xbcc24828 Handle=0xd6d3f620 Flags=ROD/KPP[61]
    LibraryObject:  Address=0x8031b7b0 HeapMask=0001-0001-0001-0000 Flags=EXS[0000] Flags2=[0000] PublicFlags=[0000]
      ReadOnlyDependencies:  count='1' size='16'
        ReadDependency:  num='0' Table=0x8031c658 Reference=0x8031bbf0 Handle=0x818b62f8 HandleFlag=0x10012841 RefFlags=DEP/ROD[21]
      DataBlocks:
        Block:  #='0' name=KGLH0^efe9f654 pins=0 Change=NONE
          Heap=0xd26770b8 Pointer=0x8031b880 Extent=0x8031b708 Flags=I/-/P/A/-/-/-
          FreedLocation=0 Alloc=1.265625 Size=3.976562 LoadTime=4629556046
    NamespaceDump:
      STATS:  phd=0x818b62f8 chd=0xd6d3f620 planhsh=5111da46 flg=1 Parse Count=1 Disk Reads=0 Disk Writes (Direct)=0 Disk Reads (Direct)=0 Physical read requests=0 Physical read bytes=0 Physical write requests=0 Physical write bytes=0 IO Interconnect bytes=0 Buffer Gets=22 Rows Processed=1 Serializable Aborts=0 Fetches=2 Execution count=1 PX Server Execution Count=0 Full Execution Count=1 CPU time=7000 Elapsed time=6158 Avg Hard Parse Time=5220 Application time=0 Concurrency time=0 Cluster/RAC time=0 User I/O time=0 Plsql Interpretor time=0 JVM time=0 Sorts=0

Keeping Cursor in the Cache
构建一个游标是相对昂贵的操作。CPU消耗和将对象放入库缓存的IO可能会显著降低性能。这通常表现为解析CPU消耗的增加,特别是库缓存latch或互斥锁成为最主要的等待事件。因此,一个明显的目标是将游标保存在库缓存中。但是,必须保持平衡,否则会出现其他性能限制问题。共享池必须包含许多类型的对象,而库缓存对象只是这些类型之一。另外,内存是有限的资源。下面的小节将讨论影响Oracle在缓存中保存游标的各种方法。

Increase the Likelihood of Caching
Oracle无法释放打开的游标。即使共享池被刷新,打开的游标也被固定,因此无法释放。通常,当游标执行完成时,将关闭游标,游标固定被删除,如果没有其他会话固定游标,Oracle可以释放关联的内存。这允许新的和活动的游标保留在内存中,而较不活动的游标则自然释放。但是,如果解析成为一个重要的性能问题,作为性能分析人员,我们就会有动机影响Oracle将游标保存在内存中,一种方式是保持游标为打开状态。

Oracle允许我们保持游标比通常打开的时间更长。实例参数cursor_space_for_time当设置为true(缺省值为false)时,将所有游标固定,直到它们被特别关闭。即使在游标执行完成之后,Oracle也会保持游标固定,直到游标关闭为止。

但是,与所有调优更改一样,也有一个权衡。此实例参数影响整个Oracle实例中的所有游标。此外,它不是特定于会话的,参数更改需要实例重启才能生效。真正的含义是,现在需要更多共享池内存来缓存库缓存对象。实际上,这种影响可能非常显著,以至于共享池可能会有效地耗尽内存,从而导致可怕的4031“共享池内存耗尽”错误。所以在设置这个参数时必须小心。

就我个人而言,除非存在明显的解析问题(至少三种情况中的两种),否则我不会启用此选项:CPU消耗由解析时间和共享池latch争用或库缓存latch争用或互斥锁争用控制。相反,如果出现“out of shared pool memory”错误,请确保cursor_space_for_time被设置为false。

Force Caching
大多数dba都知道,确保大型包成功加载到共享池的一种方法是使用dbms_shared_pool.keep过程。当实例启动后立即将关键包加载到内存中时,收到“out of shared pool memory”错误的几率将显著降低。尤其是在早期版本的Oracle中,特别是在Oracle 8i中,这可以显著降低耗尽共享池内存的可能性。

下面是一个基于v$db_object_cache视图的OSM报告并且显示了在Oracle实例启动后被初始加载的对象。注意,生成报表时,共享池中没有强制保存符合报表选择标准的对象。

SQL> @dboc 10 20
old   9: where  a.sharable_mem >= &min_size
new   9: where  a.sharable_mem >= 20
old  10:   and  a.executions >= &min_exec
new  10:   and  a.executions >= 10

DB/Inst: jy/jy1                                                   24-Apr 09:37am
Report:   dboc.sql             OSM by OraPub, Inc.                Page         1
                      Oracle Database Object Cache Summary

                                                 Obj          Exe  Size
Owner        Obj Name                            Type Loads   (k)  (KB) Kept?
------------ ----------------------------------- ---- ----- ----- ----- -----
SYS          DBMS_STATS_INTERNAL                 PBDY     0   386   492 NO
SYS          PLITBLM                             PKG      0   166     8 NO
SYS          DBMS_ASSERT                         PBDY     0    49    16 NO
SYS          STANDARD                            PBDY     0    27    32 NO
SYS          DBMS_STATS_INTERNAL                 PKG      0    24   622 NO
SYS          DBMS_SQLDIAG_INTERNAL               PKG      0    18    12 NO
SYS          DBMS_LOB                            PBDY     0    15    32 NO

DB/Inst: jy/jy1                                                   24-Apr 09:37am
Report:   dboc.sql             OSM by OraPub, Inc.                Page         2
                      Oracle Database Object Cache Summary

                                                 Obj          Exe  Size
Owner        Obj Name                            Type Loads   (k)  (KB) Kept?
------------ ----------------------------------- ---- ----- ----- ----- -----
SYS          DBMS_SQLDIAG                        PBDY     0     8    40 NO
SYS          DBMS_SQL                            PBDY     0     3    74 NO
SYS          DBMS_STANDARD                       PKG      0     1    48 NO
SYS          DBMS_STATS                          PBDY     0     1  1213 NO
SYS          DBMS_SQLTUNE_UTIL0                  PBDY     0     1    16 NO
SYS          DBMS_STATS_ADVISOR                  PKG      0     0    24 NO
SYS          DBMS_SPACE_ADMIN                    PBDY     0     0    44 NO

DB/Inst: jy/jy1                                                   24-Apr 09:37am
Report:   dboc.sql             OSM by OraPub, Inc.                Page         3
                      Oracle Database Object Cache Summary

                                                 Obj          Exe  Size
Owner        Obj Name                            Type Loads   (k)  (KB) Kept?
------------ ----------------------------------- ---- ----- ----- ----- -----
SYS          DICTIONARY_OBJ_NAME                 FNC      0     0     8 NO
SYS          DICTIONARY_OBJ_OWNER                FNC      0     0     8 NO
SYS          DBMS_UTILITY                        PKG      0     0    12 NO
SYS          DBMS_UTILITY                        PBDY     0     0    57 NO
SYS          DBMS_APPLICATION_INFO               PBDY     0     0     8 NO
SYS          IS_VPD_ENABLED                      FNC      0     0     8 NO
SYS          DBMS_SPACE_ADMIN                    PKG      0     0    60 NO

DB/Inst: jy/jy1                                                   24-Apr 09:37am
Report:   dboc.sql             OSM by OraPub, Inc.                Page         4
                      Oracle Database Object Cache Summary

                                                 Obj          Exe  Size
Owner        Obj Name                            Type Loads   (k)  (KB) Kept?
------------ ----------------------------------- ---- ----- ----- ----- -----
SYS          DBMS_SQLTUNE_INTERNAL               PBDY     0     0   532 NO
SYS          DBMS_AUTO_TASK                      PKG      0     0     8 NO
SYS          DICTIONARY_OBJ_TYPE                 FNC      0     0     8 NO
SYS          PRVT_ADVISOR                        PBDY     0     0   176 NO
SYS          AW_TRUNC_PROC                       PRC      0     0     8 NO
SYS          DBMS_ADVISOR                        PBDY     0     0    69 NO
SYS          DBMS_SQLTUNE_UTIL2                  PBDY     0     0    20 NO

DB/Inst: jy/jy1                                                   24-Apr 09:37am
Report:   dboc.sql             OSM by OraPub, Inc.                Page         5
                      Oracle Database Object Cache Summary

                                                 Obj          Exe  Size
Owner        Obj Name                            Type Loads   (k)  (KB) Kept?
------------ ----------------------------------- ---- ----- ----- ----- -----
SYS          DBMS_SQLTUNE_UTIL1                  PBDY     0     0    57 NO
SYS          DBMS_OUTPUT                         PBDY     0     0    12 NO
SYS          DBMS_STATS                          PKG      0     0   252 NO
SYS          DBMS_PRIV_CAPTURE                   PBDY     0     0    12 NO
SYS          DBMS_SPACE                          PKG      0     0    20 NO
SYS          AW_DROP_PROC                        PRC      0     0    12 NO
SYS          DBMS_ISCHED                         PBDY     0     0   387 NO

DB/Inst: jy/jy1                                                   24-Apr 09:37am
Report:   dboc.sql             OSM by OraPub, Inc.                Page         6
                      Oracle Database Object Cache Summary

                                                 Obj          Exe  Size
Owner        Obj Name                            Type Loads   (k)  (KB) Kept?
------------ ----------------------------------- ---- ----- ----- ----- -----
SYS          DBMS_SESSION                        PBDY     0     0    20 NO

36 rows selected.

SQL> l
  1  select a.owner ownerx,
  2         a.name  namex,
  3         decode(a.type,'PACKAGE','PKG','PACKAGE BODY','PBDY','FUNCTION','FNC','PROCEDURE','PRC') typex,
  4         a.loads/1000 loadsx,
  5         a.executions/1000 execsx,
  6         a.sharable_mem/1024 sizex,
  7         a.kept keptx
  8  from   v$db_object_cache a
  9  where  a.sharable_mem >= &min_size
 10    and  a.executions >= &min_exec
 11    and  a.type in ('PACKAGE','PACKAGE BODY','FUNCTION','PROCEDURE')
 12* order by executions desc, sharable_mem desc, name
SQL>

当强制对象保存在共享池中时,请注意,Oracle最近使用最少的(LRU)共享池内存管理算法的影响。我们说的是我们比Oracle更了解。实际上可能就是这样,因为大多数dba都非常了解他们的应用程序。但是,在您这样做之前,将共享池装满诸如圣诞袜之类的包实际上会增加内存溢出错误的可能性,因为留给数百个(如果不是数千个)其他共享池对象的空间很小。所以,在使用这个程序之前要仔细考虑。

Private Cursor Caches
问题是:由于库缓存在所有会话之间共享,因此必须运行某种类型的序列化控制机制。无论机制是latches还是mutexes,这意味着获取控制结构与访问内存结构都是要消耗CPU资源的。如果访问变得紧张,可能触发大量的竞争,导致严重的性能下降。因此,就会问一个看似愚蠢但又合乎逻辑的问题:“我们能不能简单地不使用控制结构?”。

当然可以,如果序列化不是问题的话。Oracle所做的是通过为每个会话提供自己的私有库缓存结构来降低需要序列化库缓存访问的可能性,该结构只包含会话的常用游标(实际上只是指向游标的指针,这是它们的句柄)。因为游标缓存是私有的,序列化被保证,因此不需要控制结构!这确实是一个优雅的解决方案

这种私有库缓存结构也叫作会话游标缓存,缺省情况下,每个会话有一个游标缓存包含指向常用游标的指针。缺省情况下,Oracle 10gr2缓存20个游标指针。Oracle 11gr1是50个游标指针。不管缺省值是多少,缓存大小可以在系统级(不是会话级)通过修改session_cached_cursors实例参数来进行修改。

其过程如下:当运行一个SQL语句时,会话创建语句的哈值,然后检查句柄是否存在于自己的游标缓存中。因为没有其它进程能访问会话的游标缓存,不需要请求控制结构。如果句柄被找到,会话知道游标存在于缓存中。如果游标没有在会话游标缓存中找到,哈希值将被哈希到一个库缓存哈希桶中,获得合适的控制结构,然后序列化扫描链表,查找游标。如果句柄在会话的游标缓存中找到,虽然花费了一些精力进行解析,但它与硬解析是不一样的(语句没有在库缓存中找到)或者甚至与软解析也不一样(语句在库缓存中找到),因此术语软软解析(softer parse)用来描述这种方
法。

好消息就是库缓存(library cache)竞争可以通过增加每个会话的游标缓存来显著减少。坏消息是每个会话的游标缓存确实增加了。如果Oracle实例有几百个会话,所有会话游标缓存可能请求大量的内存进行导致共享池内存可用性的问题。当做得太过火时就会知道,因为将收到4031“out of memory”错误。在这时可以减小会话缓存大小或者如果有内存可用,增加共享池大小。因此,与几乎所有调优工作和参数一样,都要付出代价。作为性能分析师,我们希望成本小于性能收益。

Library Cache Latch/Mutex Contention Identification and Resolution
随着库缓存变得越来越活跃,对控制结构和控制结构占用时间的竞争可能会增加很多,从而成为一个严重的性能问题。当这种情况发生时,它将变得很明显,因为我们的响应时间分析将清楚地指向库缓存latch或与互斥锁相关的等待事件。此外,Oracle的CPU消耗将非常大,递归SQL或解析相关的时间将非常之多。操作系统将经受CPU瓶颈。幸运的是,有几个非常好的解决方案可以解决这个问题。

下面的脚本输出结果中可以看到几个library cache latch竞争,几乎100%的latch竞争是与library cache相关的。

SQL> @swpctx
Remember: This report must be run twice so both the initial and
final values are available. If no output, press ENTER twice.

DB/Inst: RLZY/RLZY1                                               26-Apr 08:52am
Report:   swpctx.sql           OSM by OraPub, Inc.                Page         1
            System Event CHANGE (5 sec interval) Activity By PERCENT

                                       Time Waited  % Time    Avg Time     Wait
Wait Event Display Name                      (sec)  Waited Waited (ms) Count(k)
-------------------------------------- ----------- ------- ----------- --------
latch: library cache                         3.580    55.50       41.1        0
latch: library cache pin                     2.830    43.88       23.2        0
control file parallel write                  0.030     0.47        1.5        0
direct path write                            0.000     0.00        0.0        0
log file sync                                0.000     0.00        0.0        0
log file parallel write                      0.000     0.00        0.0        0
db file sequential read                      0.000     0.00        0.0        0

启用Mutexes
下面的脚本输出结果与之前的唯一差别是通过设置实例参数_kks_use_mutex_pin为true(缺省值为true)来启用了library cache mutexes。注意top等待事件是cursor: pin S。结果就是游标正被重复地密集地打开与关闭。尽管在启用与禁用mutexes时递归SQL的百分比是相同的,但当使用latches时,总CPU消耗几乎是使用mutexes时的两倍。

SQL> @swpctx
Remember: This report must be run twice so both the initial and
final values are available. If no output, press ENTER twice.

DB/Inst: RLZY/RLZY1                                               26-Apr 08:54am
Report:   swpctx.sql           OSM by OraPub, Inc.                Page         1
            System Event CHANGE (5 sec interval) Activity By PERCENT

                                       Time Waited  % Time    Avg Time     Wait
Wait Event Display Name                      (sec)  Waited Waited (ms) Count(k)
-------------------------------------- ----------- ------- ----------- --------
cursor: pin S                                2.630   94.27        47.0        0
control file parallel write                  0.030    1.08         1.5        0
direct path write                            0.000    0.00         0.0        0
db file sequential read                      0.000    0.00         0.0        0
log file parallel write                      0.000    0.00         0.0        0
log file sync                                0.000    0.00         0.0        0


使用绑定变量来创建类似SQL
Oracle对于它认为的类似SQL语句是非常讲究的。每个语句必须被解析,并且如果游标在library cache中没有找到,游标必须被完全构建(硬解析)。硬解析需要使用与库缓存相关的latches与锁,因此,如果硬解析变得如此强烈,相关的等待事件将被出现在报告的顶部,我们将寻找创建类似SQL语句的方法。Oracle提供了两种强大的方法来实现这一点。

第一方法是简单使用绑定变量来代替文本字。例如,语句select * from employee where emp_no=100使用文本值。如果语句select * from employee where emp_no=200被执行,因为Oracle的哈希算法,两个语句有不同的哈希值,将存放在不同的哈希桶中,并且有不同的handle。正如你所想的一样,当有密集的联机事务活动时,这将导致大量的硬解析。如果应用程序开发者可以提交这样的语句select * from employee where emp_no=:b1,使用绑定变量,游标将不会包含雇员号,并且游标可以高度重用(因为没有雇员号,相同的游标可以被重用)。这将显著减少硬解析。查看语句是否使用绑定变量非常简单。查看Oracle所存储的SQL,在v$sqltext中。如果使用绑定变量,您将看到它们。发现几个library cache相关的竞争可能导致你认识到绑定变量没有使用。应用程序开发者将非常不高兴,因为这需要大量的返工。

使用游标共享
另一种快速实现使用绑定变量的方法是让Oracle自动转换SQL语句。Oracle将有效地将没有使用绑定变量的SQL语句转换为使用绑定变量的语句。如果看到类似下面的语句就是Oracle自动转换的使用绑定变量的SQL:

select count(*)
from customers
where status != :"SYS_B_0"
and org_id != :"SYS_B_1"

如果您非常了解应用程序SQL,那么您可能会意识到这个确切的SQL实际上并不存在于应用程序的任何地方。实际上,如果您检查了应用程序提交给Oracle的SQL,它可能是这样的。

select count(*)
from customers
where status != 'ACTIVE'
and org_id != '15043'

结果就是你看到的Oracle自动转换SQL了使用它变得更容易共享。Oracle叫这个功能为cursor sharing(游标共享)。相关的实例参数为cursor_sharing,它有三个选项并且可以在会话级与系统级进行修改。当使用exact时,不会出现自动转换。当使用similar时,Oracle将寻找绑定变量并进行自动转换。当使用force时,Oracle会自动转换任何与每个文本值为绑定变量。

如果您向一组性能分析人员询问他们在游标共享方面的经验,您将立即得到一个看似矛盾而又充满激情的讨论。有些人,像我自己在使用similar选项时有美好的经历,其它人有各种各样的问题。有些人使用force选项后看到他们的SQL语句发生了巨大的变化并且SQL语句的结果集也不一样了。例如,原来返回10行记录的,现在只返回2行记录,有效的破坏了应用程序。

显然,您需要与您的同事交谈,与Oracle support进行检查,并测试特定环境中的各种选项。如果物理上无法更改SQL以使用绑定变量,或者非常痛苦,那么游标共享可以非常有效地工作。但是在生产环境中使用该选项之前,您必须非常勤奋地进行严格的测试。

利用哈希结构
从搜索角度来说,library cache是采用哈希结构来构建的。因此就像buffer cache chains一样,我们可以修改哈希桶的数量和latches的数量。当使用mutexes时,Oracle设置mutex内存结构关系。例如,每个library cache对象有属于自己的mutex。

根据Oracle版本的不同,Oracle实际上可能不会透露库缓存桶或锁存器的数量。例如Oracle 10gr2可能显示的library cache buckets的数量为9,library cache latches的数量为零。

Oracle允许通过实例参数_kgl_bucket_count来查看哈希桶的数量。library cache latches的数量是由实例参数_kgl_latch_count来控制的。现实中没有一个人通过增加生产系统中library cache哈希桶的数量并成功减少library cache latch竞争的。然而,就像cache buffer chain latches一样,library cache latch竞争可以通过增加library cache latches的数量来减少。

Try Mutex-Focused Solutions
当mutexes可用时,启用它们。可以通过将实例参数_kks_use_mutex_pin设置为false来禁用mutexes。如果你的系统正在遭受严重的mutex(互斥锁)问题,Oracle技术支持工程师可能会建议你关闭mutexes直到应用补丁为止。

大多数Oracle站点永远不会发生mutex(互斥)争用,如果发生mutex争用,那么压力可能与将游标固定在共享或独占模式有关。

有趣的是,要让互斥锁运行,操作系统必须支持比较和交换(CAS)操作。减少指令集计算机(RISC)操作系统,比如AIX或PA-RISC,可能选择通过消除比较和交换(CAS)操作来减少它们的指令集。在这种情况下,Oracle将通过使用一个latches池(在oracle 11gr1中缺省是有1024)池来模拟比较和交换(CAS)操作。latches被命名为KGX,并且可以通过修改实例参数_kgx_latches来改变它的数量,显然,这对于性能来说不是最优的,但是我们希望最终的结果是有益的。

SQL> select x.ksppinm NAME,y.ksppstvl value,x.ksppdesc describ
  2  from x$ksppi x, x$ksppcv y
  3  where x.inst_id=USERENV('Instance')
  4  and y.inst_id=USERENV('Instance')
  5  and x.indx=y.indx
  6  and x.ksppinm like '%_kgx_latch%';

NAME              VALUE   DESCRIB
----------------- ------- -------------------------------------------------
_kgx_latches      1024    # of mutex latches if CAS is not supported.

实际上有许多与mutex(互斥)锁相关的等待事件。虽然我希望所有与mutex(互斥)锁相关的等待事件都是以mutex(互斥)锁开始,但是Oracle采取了不同的方法。与库缓存关联的mutex(互斥)对象都以单词cursor开头。这是有意义的,因为库缓存中充满了游标,但是它使性能分析人员更难发现新的mutex(互斥)对象的使用情况。

Mutex等待事件如下:
cursor:mutex X
当一个会话以排他模式请求一个mutex时,通过spinning不能获得因此进入休眠时将会post这个等待事件。只需要一个会话以共享模式持有mutex(互斥)锁,就可以防止排他性获取。构建一个子游标,捕获SQL绑定变量数据,构建或更新游标相关统计信息都需要以排他模式来请求mutex。

cursor: mutex S
当一个会话以共享模式请求一个mutex时,通过spinning不能获得因此进入休眠时将会post这个等待事件。多个会话可以以共享模式来持有一个mutex。如果一个mutex被另一个会话以排他模式所持有那么它将不能以共享模式被持有。当扫描引用计数时,一个会话以共享模式持有mutex,而不是排他模式。因此另外的会话可能正在更改引用计数。当出现这种情况时,mutex会被称为”正在变化中”。要看到这个事件是非常困难的,因为更改引用计数的速度非常快(有人告诉我,算法也建议这样做)。因此当多个会话以共享模式持有mutex时,更改引用计数实际上是一个串行操作。

cursor: pin S
当一个会话以共享模式请求pin(固定)一个游标时,通过spinning(自旋)不能完成因此而休眠时就会posts这个等待事件。多个会话可以以共享模式来pin(固定)一个相同的游标,但只能有一个会话以排他模式来持有一个mutex。Pinning将增加mutex的引用计数,这是一种序列化操作。因为一个会话必须pin(固定)一个游标才能执行游标(游标在执行期间不会被回收),当一个被频繁访问的游标被多个会话重复执行时可以在系统中看到这个等待事件。

cursor: pin X
当一个会话以排他模式请求pin(固定)一个游标时,通过spinning(自旋)不能完成因此而休眠时就会posts这个等待事件。只需要一个会话以共享模式固定mutex(互斥)锁,就可以防止排他性占有。当创建游标时必须以排他模式来固定。你不想在同一时刻其它的会庆创建或修改相同的游标。

cursor: pin S wait on X
当一个会话以共享模式来pin(固定)游标时,因为另外的会话以排他模式持有mutex而必须等待时就会posts这个等待事件。例如,如果一个会话只想简单地执行游标,它必须以共享模式来请求mutex。然而,当会话正在执行游标时,如果另外的会话正在构建或修改游标(请求以排他模式来固定),将会post这个等待事件。当多个会话想执行这个游标时而游标正在被重建(可能基表已经被修改了)时就会看到这个等待事件。

解决互斥锁相关争用的关键是同时理解等待事件和应用程序中正在发生的事情。例如,如果等待事件是cursor:pin S(最可能的),可能是相同的cursor被一些用户重复执行,几个游标被许多用户执行,甚至一个简单的SQL语句是由数百个用户并发执行。理解了这一点之后,您将寻找执行频率相对较高的SQL语句,并尽一切可能降低其执行频率。使用等待事件让你了解与游标相关的特殊情况,并了解应用程序的性质,这是最佳的解决方案路径。

同样,互斥锁等待不太可能是最重要的等待事件(当没有相关的互斥锁错误时),但它偶尔会发生。因此,理解互斥锁序列化控制以及库缓存内部结构和诊断是非常重要的。

Oracle Cursor

游标是一个基本对象,它是SQL语句或PL/SQL编程式构造的一种完整可执行表示,可以被任何授权会话使用和重用。游标必须被创建,定位(通过搜索来查找),消毁(回收),失效与重载。如果游标的任何部分不在共享池中,并且出于任何原因需要,则必须重新加载该游标,这会降低性能。

开发人员通常对游标有很好的理解因为他们需要专门创建,打开,执行,获取与关闭游标。DBA通常将游标作为与SQL相关的简单内存块来看待。然而,这种过于简单的关点限制了我们为与游标相关的性能问题创建解决方案的能力。因此,如果花时间更好地理解游标,将会注意到性能解决方案选项将显著增加。

父游标与子游标
游标这个术语本身是一个抽象概念,用来引用共享的信息(位于共享SQL区),私有信息(位于会话的PGA)与用来定位各种游标组件的library cache chain节点(当引用library cache时就叫作handle)。不幸地是这种多用途的定义也增加了混淆。当一个游标被关闭时,Oracle不会简单的回收这三个游标组件。而是Oracle可能会按需来回收游标组件。

一个游标第一次执行时,会存在一个父游标与子游标。后续的会话,即使相同的会话执行相同的SQL语句(哈希值相同),可能会使用不同的子游标。虽然SQL语句在文本上完全相同,但是创建子游标是为了捕获特定的特征,比如优化模式的差异(例如first_rows),这会导致不同的执行计划或不同的会话级参数(cursor_sharing=similar)。下面的例子简单的显示了相同会话执行相同SQL语句两次,只是在两次执行之间执行了alter session命令,这足以强制创建一个额外的子游标。trace命令用来证明创建了两个子游标。

SQL> oradebug setmypid
Statement processed.
SQL> alter session set optimizer_mode = all_rows;

Session altered.

SQL> select * from dual;

D
-
X

SQL> alter session set optimizer_mode = first_rows;

Session altered.

SQL> select * from dual;

D
-
X

SQL> alter session set events 'immediate trace name library_cache level 10';

Session altered.

SQL> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/jy/jy1/trace/jy1_ora_6675.trc

下面的内容是上面的trace命令所创建的跟踪文件中的一部分内容。我们通过搜索select * from dual来定位我们关心的内容并检查SQL语句。此时,我们感兴趣的是,这条SQL语句仅由一个会话执行,但它创建了两个子游标。

Bucket: #=108289 Mutex=0xc5eeae00(3298534883328, 1118, 0, 6)
  LibraryHandle:  Address=0xcf2e9a48 Hash=382da701 LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
    ObjectName:  Name=select * from dual
      FullHashValue=0d54fc02b2ad4044a2cb0974382da701 Namespace=SQL AREA(00) Type=CURSOR(00) ContainerId=1 ContainerUid=1 Identifier=942515969 OwnerIdn=0
    Statistics:  InvalidationCount=0 ExecutionCount=2 LoadCount=3 ActiveLocks=0 TotalLockCount=2 TotalPinCount=1
    Counters:  BrokenCount=1 RevocablePointer=1 KeepDependency=2 Version=0 BucketInUse=1 HandleInUse=1 HandleReferenceCount=0
    Concurrency:  DependencyMutex=0xcf2e9af8(0, 2, 0, 0) Mutex=0xcf2e9b98(768, 37, 0, 6)
    Flags=RON/PIN/TIM/PN0/DBN/[10012841] Flags2=[0000]
    WaitersLists:
      Lock=0xcf2e9ad8[0xcf2e9ad8,0xcf2e9ad8]
      Pin=0xcf2e9ab8[0xcf2e9ab8,0xcf2e9ab8]
      LoadLock=0xcf2e9b30[0xcf2e9b30,0xcf2e9b30]
    Timestamp:  Current=04-17-2019 09:33:16
    HandleReference:  Address=0xcf2e9c20 Handle=(nil) Flags=[00]
    ReferenceList:
      Reference:  Address=0x84497a08 Handle=0x818e2850 Flags=ROD[21]
      Reference:  Address=0x84c9e3d0 Handle=0xb28b76a0 Flags=ROD[21]
    LibraryObject:  Address=0xbd5972a8 HeapMask=0000-0001-0001-0000 Flags=EXS[0000] Flags2=[0000] PublicFlags=[0000]
      DataBlocks:
        Block:  #='0' name=KGLH0^382da701 pins=0 Change=NONE
          Heap=0x83043cc0 Pointer=0xbd597378 Extent=0xbd597200 Flags=I/-/P/A/-/-/-
          FreedLocation=0 Alloc=3.390625 Size=3.976562 LoadTime=4111958371
      ChildTable:  size='16'
        Child:  id='0' Table=0xbd598128 Reference=0xbd597bf8 Handle=0xb38e2928
        Child:  id='1' Table=0xbd598128 Reference=0xbd597f48 Handle=0xbdfc20a8
    NamespaceDump:
      Parent Cursor:  sql_id=a5ks9fhw2v9s1 parent=0xbd597378 maxchild=2 plk=n ppn=n prsfcnt=0 obscnt=0
        CursorDiagnosticsNodes:
          ChildNode:  ChildNumber=0 ID=3 reason=Optimizer mismatch(10) size=3x4 optimizer_mode_hinted_cursor=0 optimizer_mode_cursor=1 optimizer_mode_current=2

库缓存对象之间的关系不仅为执行目的而必须维护,而且当其中一个组件发生更改时也必须维护。假设一个表被2000个SQL语句,100个函数与20个包所引用。现在假设表的一列被重命名。Oracle将会使所有相关的SQL语句与程序结构失效。这可能导致在请求latching与locking时出现级联效应。多个相关会话、失效、重新编译和计时的组合导致整个Oracle实例被锁定。很明显Oracle已经知道了这种问题的严重性并且积极的减小出现这种情况的可能性。但每个DBA要了解library cache之间的关系是非常复杂的并且有时可能导致出现问题。

Cursor Building
当在library cache中搜索并没有找到游标时就会创建游标。这就是硬解析。很明显这是一个相对昂贵的操作它需要请求内存管理(分配与可能回收),使用latching来确保序列化,使用locking来阻止不合适的更改,执行内核代码需要消耗CPU资源,和可能需要IO操作来将数据字典信息插入row cache中。

游标是使用共享池中的数据来创建的,如果数据当前不在共享池中,Oracle将创建它自己的SQL语句来从数据字典表中检索数据。Oracle动态创建的SQL会命名为递归SQL并运行它。为了创建一个游标Oracle需要的数据是优化器统计信息,会话信息,安全信息,对象信息与对象关联信息。

游标是由称为堆的共享池内存块创建的。传统上,不同的SQL语句需要不同大小的内存块。常见的SQL语句通常请求4KB大小的内存块。与free exten管理一样,请求不一致大小的内存块会导致分配,性能与效率问题。从Oracle 10gr2开始,Oracle将所有的内存块定义为4KB。当合适的内存块不能快速地找到时,Oracle最终可能会放弃并posts一个4031错误“out of shared poll memory”并停止SQL语句的处理。

Cursor Searching Introduction
与buffer cache中的每个buffer一样,每个父游标与子游标必须被定位并且搜索必须要快速。这将请求内存,一个搜索结构,序列化,内核代码与大量CPU资源。

因为游标与程序结构存放在library cache中,有一个结构来定位对象。Oracle选择使用哈希算法与相关哈希类似结构。解析操作的一部分是判断一个游标当前是否存放在library cache中了。如果确实在library cache中找到了这个游标,进行了一些解析操作,因此它确实是一个软解析。然而如果在library cache中没有找到这个游标,整个游标需要被创建,因此它就是硬解析。游标创建与硬解析是相当昂贵的操作。

Cursor Pinning and Locking
固定游标类似于固定buffer。它被用来确保当游标被引用时不会被回收(有时也叫破坏)。游标显然不是关系结构,但是SQL与关系结构(例如employee表)相关,关系结构用于构建游标(例如sys.col$),因此使用了锁——也就是说,使用了队列。游标队列也叫作CU队列并且就像其它队列一样通过Oracle的等待接口可以检测。

当创建与执行游标时就要固定游标。这是很容易理解的,当你创建一个游标时,它是一种内存结构,你不想其它的进程回收相关的内存。正常情况下,游标在创建与执行完成后不会出现固定的情况。这意味着在你执行一个游标后且等待2分钟后你想再次执行相同的游标,这时游标可能已经被回收了。如果出现这种情况,在library cache中找不到需要的游标,将会执行硬解析,它将完全重新创建游标。

在创建与执行游标时也可能会出现锁定的情况。但它不同于固定游禁。固定的关注点在于内存回收。而锁是确保与游标相关的表在创建与执行游标时不被修改。显然,这可能会造成一些相当奇怪的情况,而Oracle不会允许这种情况发生。