Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

From Oracle to PostgreSQL: the most complete control file

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Original text:

From Oracle to PostgreSQL: the most complete control file (part I) https://www.enmotech.com/web/detail/1/770/1.html

From Oracle to PostgreSQL: the most complete control file (part two) https://www.enmotech.com/web/detail/1/771/1.html

Introduction: this paper introduces the basic contents of Oracle and PostgreSQL control files, describes in detail how to rebuild PostgreSQL control files and carries out recovery tests.

Control the contents of the file

Oracle controls file content

It can be seen from the official documents that the control file holds the following information:

Database name, data creation time and other related data files and redo log files name and location tablespace information redo log thread, file information backup set and backup file information checkpoint and SCN information 12c added PDB information

Because the control file is a binary file, it cannot be opened and consulted directly. You can dump the contents of the control file for easy viewing, and you can use the following command to do the dump.

SQL > alter session set events' immediate trace name controlf level 8 session altered.SQL > select value from v$diag_info where name='Default Trace File' VALUE----/u01/app/oracle/diag/rdbms/rac12201/RAC122011/trace/RAC122011_ora_24813.trc

Note that starting at 11g, the name of the current session dump file can be obtained through v$diag_info.

If you open the trace file, you can clearly see the contents of the control file. The first paragraph is a summary of the database ID, name, etc.:

Trace file / u01/app/oracle/diag/rdbms/rac12201/RAC122011/trace/RAC122011_ora_24813.trcOracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit ProductionBuild label: RDBMS_12.2.0.1.0_LINUX.X64_170125ORACLE_HOME: / u01/app/oracle/product/12.2.0.1/dbhome_1System name: LinuxNode name: ractest1Release: 2.6.32-431.el6.x86_64Version: # 1 SMP Sun Nov 10 22:19:54 EST 2013Machine: x86_64Instance name: RAC122011Redo thread mounted by this instance: 1Oracle process number: 96Unix process pid: 24813 Image: image: oracle@ractest1 (TNS V1-V3) * * 2019-05-30T09:15:38.980823+08:00 (CDB$ROOT (1)) * * SESSION ID: (59.49876) 2019-05-30T09VO 15V 38.980878V 08V 08VOV 00V * CLIENT ID: () 2019-05-30T09UR 1538.8885V 08VOG 00V * SERVICE NAME: (SYS$USERS) 2019-05-30T09UR 15V 38.980891U 08RH * MODULE NAME: (sqlplus@ractest1 (TNS V1-V3) 2019-05 CLIENT DRIVER: (SQL*PLUS) 2019-05-30T09 SQL*PLUS 1538. 980908-30T09 CONTAINER ID: (1) 2019-05-30T09:15:38.980914+08:00DUMP OF CONTROL FILES Seq # 233771 = 0x3912bV10 STYLE FILE HEADER: Compatibility Vsn = 203424000=0xc200100 Db ID=1217928546=0x48981d62, Db Name='RAC12201' Activation ID=0=0x0 Control Seq=233771=0x3912b, File size=1216=0x4c0 File Number=0, Blksiz=16384, File Type=1 CONTROL

Next is the details of the data entry, including the name of the data, the number of data files and log files, the checkpoints of the database and SCN information, etc.

* DATABASE ENTRY*** * * (size = 316 Compat size = 316, section max = 1, section in-use = 1, last-recid= 0, old-recno = 0, last-recno = 0) (extent = 1, blkno = 1, numrecs = 1) 2019 23:47:46DB Name "RAC12201" Database flags = 0x10406001 0x00001200 0x00000082Controlfile Creation Timestamp 03 23:47:46DB Name 2019 23:47:47Incmplt recovery scn: 0x0000000000000000Resetlogs scn: 0x0000000000157e2e Resetlogs Timestamp 03 23:47:46DB Name 2019 23:47:49Prior resetlogs scn: 0x0000000000000001 Prior resetlogs Timestamp 0126 13:52:29Redo Version 2017 13:52:29Redo Version: compatible=0xc200100#Data files = 28 # Online files = 25Database checkpoint: Thread=1 scn: 0x0000000002a1699eThreads: # Enabled=2, # Open=2, Head=1, Tail=2enabled threads: 01100000 00000000 00000000 00000000 00000000.Max log members = 3, Max data members = 1Arch list: Head=1, Tail=9 Force scn: 0x00000000029c57a6scn: 0x0000000000000000Activation ID: 1217928802Snapshot Controlfile filename name # 31: + DATA/snapcf_rac12201.fSnapshot Controlfile checkpoint scn: 0x00000000026d24dd 05 0x0000000002a231ff 25 22:40:30SCN compatibility 1Auto-rollover enabledControlfile Checkpointed at scn 2019 09:15:32thread:0 rba: (0x0.0.0) enabled threads: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Then there is the checkpoint record information, which contains Low Cache RBA and On Disk RBA information. When performing a database instance recovery, the former is the starting point of the recovery and the latter is the end point of the recovery, which points to the identified address in the log file, respectively:

* CHECKPOINT PROGRESS RECORDS** * * (size = 8180 Compat size = 8180, section max = 35, section in-use = 0, last-recid= 0, old-recno = 0, last-recno = 0) (extent = 1, blkno = 2, numrecs = 35) THREAD # 1-status:0x2 flags:0x0 dirty:54low cache rba: (0x13c.ec78.0) on disk rba: (0x13c.edda.0) on disk scn: 0x0000000002a232bc 05lash 2019 09:15:37resetlogs scn: 0x0000000000157e2e 03max 2019 23:47:49heartbeat: 1009031373 mount id: 1222276307

There are many other records in the control file, and you can dump it out and read the next entry carefully.

Let's take a look at what is recorded in the PostgreSQL control file.

PostgreSQL controls file content

Compared with the Oracle control file, the PostgreSQL control file content is much less, mainly divided into three parts, initialization static information, WAL and checkpoint dynamic information, some configuration information.

We can use the pg_controldata command to read the contents of the PostgreSQL control file directly:

[postgres@lsl-test1 ~] $/ usr/pgsql-11/bin/pg_controldata-D / pg/pg11/datapg_control version number: 1100Catalog version number: 201809051Database system identifier: 6691945724594983959Database cluster state: in productionpg_control last modified: Thu 30 May 2019 03:20:03 PM CSTLatest checkpoint location: 0/60001E8Latest checkpoint's REDO location: 0/60001E8Latest checkpoint's REDO WAL file: 000000010000000000000006Latest checkpoint's TimeLineID: 1Latest checkpoint's PrevTimeLineID: 1Latest checkpoint's full_page_writes: onLatest checkpoint's NextXID: 0:1048576Latest checkpoint's NextOID: 10000Latest checkpoint's NextMultiXactId: 65536Latest checkpoint's NextMultiOffset: 52352Latest checkpoint's oldestXID: 2296015872Latest checkpoint's oldestXID's DB: 0Latest checkpoint's oldestActiveXID: 0Latest checkpoint's oldestMultiXid: 65536Latest checkpoint's oldestMulti's DB: 0Latest checkpoint's oldestCommitTsXid:0Latest checkpoint's newestCommitTsXid:0Time of latest checkpoint: Thu 30 May 2019 03:20:03 PM CSTFake LSN counter for unlogged rels: 0/1Minimum recovery ending location: 0/0Min recovery ending loc's timeline: 0Backup start location: 0/0Backup end location: 0/0End-of-backup record required : nowal_level setting: replicawal_log_hints setting: offmax_connections setting: 100max_worker_processes setting: 8max_prepared_xacts setting: 0max_locks_per_xact setting: 64track_commit_timestamp setting: offMaximum data alignment: 8Database block size: 8192Blocks per segment of large relation: 131072WAL block size: 8192Bytes per WAL segment: 16777216Maximum length of identifiers: 64Maximum columns in an index: 32Maximum size of a TOAST chunk: 1996Size of a large-object chunk: 2048Date/time type storage: 64-bit integersFloat4 argument passing: by valueFloat8 argument passing: by valueData page checksum version: 0Mock authentication nonce: 0000000000000000000000000000000000000000000000000000000000000000

The meaning of each parameter is described in detail below.

Pg_control version number is the version number of the control file. Catalog version number is the system table version number in the format yyyymmddN. Record changes in system incompatibility. N is the number of yyymmdd changes on the day. You can check the source file catversion.h for details. The identification string of Database system identifier database system number is an integer of 64bit, which contains the timestamp of creating the database and the process number initialized when initdb is created. For specific initialization methods, please see the source file xlog.c.

The creation time can be seen through the to_timestamp transformation.

The creation time can be seen through the to_timestamp transformation. Postgres=# SELECT to_timestamp (6691945724594983959 > > 32) & (2 ^ 32-1):: bigint)); to_timestamp-2019-05-17 18 row 47 row

Database cluster state records the status of the instance. Several states of the database can be seen in the source file, and can be seen in the source pg_control.h:

Starting up: indicates that the database is in a startup state. Shut down: this is the state in the control file after the database instance (non-Standby) is shut down normally. This is the status in the control file after the shut down in recovery:Standby instance is shut down normally. Shutting down: when you stop the library normally, do checkpoint first. When you start doing checkpoint, you will set the status to this state, and then set the status to shut down. In crash recovery: after the database instance is stopped without exception, the instance will be restored first after it is restarted. This is the state when the instance is restored. This is the state after the in archive recovery:Standby instance is started normally. In production: this is the state of the database instance after it is started normally. This is not the state after the Standby database is started normally. When the Latest checkpoint location database stops abnormally and then restarts, you need to restore the instance. The process of instance recovery is to find the last checkpoint point from the WAL log, and then read the WAL log after this point and reapply these logs. This process is called database instance roll forward, and the information of the last checkpoint point is recorded in the Latest checkpont entry. Latest checkpoint's REDO location records checkpoints on database log files. Latest checkpoint's REDO WAL file records the name of the Wall log, and the file can be found by pg_wal in the directory. Latest checkpoint's NextXID is preceded by a new era value, followed by a colon and the next transaction number. The maximum security value of the current transaction number can be calculated from the file name in the pg_xact directory. The Latest checkpoint's NextMultiXactId parameter, which can be calculated from the pg_multixact/offsets file name. The Latest checkpoint's NextMultiOffset parameter, which can be calculated under the pg_multixact/members folder when restoring the control file. Maximum length of identifiers refers to the maximum length of some database object names, such as table name, the maximum length of index name Maximum columns in an index represents the maximum number of columns of an index, currently 32. Maximum size of a TOAST chunk is the maximum length of TOAST chunk. TOAST is a way to solve the problem of out-of-row storage when the contents of a column are too long to be stored in a data block. Line links similar to Oracle. Data page checksum version is the version of block checksum, which defaults to 0, and the block does not use checksum. The-k parameter is added to run initdb before PG enables the checksum feature on the data block. This is the end of the parameter introduction, and each content definition of the control file can view the source file pg_control.h.

Rebuild control file

If the control file is corrupted or missing, the database will run abnormally and cannot be started. It is also important for Oracle and PostgreSQL control files.

Oracle controls file reconstruction

For Oracle, when the control file is corrupted and there is no backup, the control file can be restored by manually rebuilding the control file.

The specific command is shown in the following figure:

For more information, please see the official documentation:

Https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/CREATE-CONTROLFILE.html#GUID-9B389F28-C4D0-405D-BFE6-48237E8BD791https://docs.oracle.com/en/database/oracle/oracle-database/12.2/admin/managing-control-files.html#GUID-98A05D29-DD80-4D87-9615-76CBCF8FE694

PostgreSQL controls file reconstruction

Use pg_resetwal to clean up the wal log or reset some control information in the control file after using pg_resetxlog,pg10 before pg9.6.

For more information on the command, you can view the official documents:

Https://www.postgresql.org/docs/11/app-pgresetwal.html

[postgres@lsl-test1] $/ usr/pgsql-11/bin/pg_resetwal-n-D / pg/pg11/datapg_resetwal: lock file "postmaster.pid" existsIs a server running? If not, delete the lock file and try again. [postgres@lsl-test1] $. / pg_resetwal-- helppg_resetwal resets the PostgreSQL write-ahead log.Usage: pg_resetwal [OPTION]. DATADIROptions:-c,-- commit-timestamp-ids=XID,XID set oldest and newest transactions bearing commit timestamp (zero means no change) [- D,-- pgdata=] DATADIR data directory-e,-- epoch=XIDEPOCH set next transaction ID epoch-f,-- force force update to be done-l,-- next-wal-file=WALFILE set minimum starting location for new WAL-m,-- multixact-ids=MXID,MXID set next and oldest multitransaction ID-n,-- dry-run no update, just show what would be done-o -- next-oid=OID set next OID-O,-- multixact-offset=OFFSET set next multitransaction offset-V,-- version output version information, then exit-x,-- next-transaction-id=XID set next transaction ID-- wal-segsize=SIZE size of WAL segments, in megabytes -?,-- help show this help, then exit

Let's take a look at the specific meaning of each parameter of the command:

The-c parameter has two parameter values, the oldest transaction number and the latest transaction number. For the security value of the oldest transaction number, you can query the smallest file name in the pg_commit_ts directory; for the security value of the latest transaction ID, you can query the largest file name in the pg_commit_ts directory. The file names are all hexadecimal. The actual test found no files in the 11 version of the pg_commit_ts directory.

[postgres@lsl-test1 data] $cd pg_commit_ts/ [Postgres @ lsl-test1 pg_commit_ts] $ls-ltotal 0

The-e parameter is the epoch that sets the transaction number, and the transaction ID era is not actually stored anywhere in the database except for the fields set by pg_resetwal. You may need to adjust this value to ensure that replication systems such as Slony or Skytools work correctly. If so, you should be able to get the appropriate values from the state of the replication database downstream.

The-l parameter manually sets the WAL startup location by specifying the name of the next WAL segment file. This option uses the WAL file name instead of LSN. The name of the next segment should be greater than any WAL segment file name that currently exists in the pg_wal directory.

[postgres@lsl-test1 pg_commit_ts] $cd. / pg_wal/ [Postgres @ lsl-test1 pg_wal] $ls-ltotal 32768 Murray. 1 postgres postgres 16777216 May 30 17:26 0000000100000000000007Murrw. 1 postgres postgres 16777216 May 30 17:26 00000001000000000008drwxMurray. 2 postgres postgres 6 May 17 17:22 archive_status

These names are also in hexadecimal, and the file name consists of three parts, the first part timeline number (timeline ID), the second part logical log number, and the third part log segment number.

The-m parameter also has two values, one is the next multi-transaction number, and the other is the oldest multi-transaction number.

For the security value of the next multi-transaction number, you can look for the file name with the highest value in the directory pg_multixact/offsets, add 1 and multiply it by 65536 (0x10000).

The security value of the oldest multi-transaction number can be multiplied by 65536 by the file name with the lowest value in the query directory. The file names are all in hexadecimal.

[postgres@lsl-test1 pg_wal] $cd. / pg_multixact/offsets/ [Postgres @ lsl-test1 offsets] $ls-ltotal 8 RWX Murray. 1 postgres postgres 8192 May 17 18:04 0000

The-o parameter is to set the next OID (OID,object is used internally by pg as the primary key of the system table). We can restore without setting this parameter, because there is no good way to set an OID that exceeds the maximum value in the database.

The-O parameter sets the next multi-transaction offset. Find the file name with the largest value in the pg_multixact/members directory, and multiply + 1 by 52352 (0xCC80) to calculate the safe value of the offset. The file name of the file under the directory is also hexadecimal.

[postgres@lsl-test1 offsets] $ls-l.. / members/total 8 Murray RWX Murray. 1 postgres postgres 8192 May 17 17:22 0000

-- the wal-segsize parameter sets the new WAL segment size.

The-x parameter is the file name that can be manually set to view the maximum value in the next transaction ID,pg_xact directory, + 1 multiplied by 1048576 (0x100000) to get the security value. The file name is also hexadecimal.

[postgres@lsl-test1 offsets] $ls-l.. /.. / pg_xact/total 16 RWX Murray. 1 postgres postgres 8192 May 17 18:04 00000 RWMI. 1 postgres postgres 8192 May 30 17:26 0001

PostgreSQL Control File recovery Test

The test process is as follows (based on PostgreSQL 11.2):

1. Create new test data and use with oids's table, because OID cannot determine whether there will be any exceptions

Postgres=# create table lsl_oid1 (id int primary key) with oids; CREATE TABLEpostgres=# insert into lsl_oid1 select generate_series (1mem100000); INSERT 0 100000postgres=# select min (oid), max (oid) from lsl_oid1; min | max-+-16400 | 116399 (1 row)

two。 Close the data and record the control file information

[postgres@lsl-test1 bin] $/ usr/pgsql-11/bin/pg_ctl stop-D / pg/pg11/datawaiting for server to shut down.... Doneserver stopped

# # write down the pg_controldata information to facilitate comparison after repair

[postgres@lsl-test1 bin] $/ usr/pgsql-11/bin/pg_controldata-D / pg/pg11/datapg_control version number: 1100Catalog version number: 201809051Database system identifier: 6691945724594983959Database cluster state: shut downpg_control last modified: Thu 30 May 2019 05:26:41 PM CSTLatest checkpoint location: 0/79E9888Latest checkpoint's REDO location: 0/79E9888Latest checkpoint's REDO WAL file: 000000010000000000000007Latest checkpoint's TimeLineID: 1Latest checkpoint's PrevTimeLineID: 1Latest checkpoint's full_page_writes: onLatest checkpoint's NextXID: 0:1048585Latest checkpoint's NextOID: 116400Latest checkpoint's NextMultiXactId: 65536Latest checkpoint's NextMultiOffset: 52352Latest checkpoint's oldestXID: 561Latest checkpoint's oldestXID's DB: 13878Latest checkpoint's oldestActiveXID: 0Latest checkpoint's oldestMultiXid: 1Latest checkpoint's oldestMulti's DB: 13878Latest checkpoint's oldestCommitTsXid:0Latest checkpoint's newestCommitTsXid:0Time of latest checkpoint: Thu 30 May 2019 05:26:40 PM CSTFake LSN counter for unlogged rels: 0/1Minimum recovery ending location: 0/0Min recovery ending loc's timeline: 0Backup start location: 0/0Backup end location: 0/0End-of-backup record required : nowal_level setting: replicawal_log_hints setting: offmax_connections setting: 100max_worker_processes setting: 8max_prepared_xacts setting: 0max_locks_per_xact setting: 64track_commit_timestamp setting: offMaximum data alignment: 8Database block size: 8192Blocks per segment of large relation: 131072WAL block size: 8192Bytes per WAL segment: 16777216Maximum length of identifiers: 64Maximum columns in an index: 32Maximum size of a TOAST chunk: 1996Size of a large-object chunk: 2048Date/time type storage: 64-bit integersFloat4 argument passing: by valueFloat8 argument passing: by valueData page checksum version: 0Mock authentication nonce: 0000000000000000000000000000000000000000000000000000000000000000

3. Simulate the control file failure and delete the control file directly

[postgres@lsl-test1 global] $pwd/pg/pg11/data/global [postgres@lsl-test1 global] $rm-rf pg_control

4. Start the database to simulate the scene of missing control files

[postgres@lsl-test1 global] $/ usr/pgsql-11/bin/pg_ctl startwaiting for server to start....postgres: could not find the database systemExpected to find itin the directory "/ pg/pg11/data", but could not open file "/ pg/pg11/data/global/pg_control": No such file or directorystopped waitingpg_ctl: could not start serverExamine the log output.

Let's start formally rebuilding the control file so that the database can start normally.

5. First create an empty file named pg_control

[postgres@lsl-test1 global] $touch $PGDATA/global/pg_control

6. Using pg_resetwal to repair pg_control

Confirm the value of the pg_resetwal parameter.

First, confirm the-c parameter. A detailed analysis of the above parameter shows that the directory is empty, so this parameter is ignored for the time being.

The-e parameter is a new era for setting the next transaction number, and our test environment has no other replication systems, so it can be ignored.

-l parameter, check the file name under pg_wal, which is greater than the maximum value of file name.

[postgres@lsl-test1] $cd / pg/pg11/data/pg_ Wal [Postgres @ lsl-test1 pg_wal] $ls-ltotal 32768 Murray. 1 postgres postgres 16777216 May 30 17:26 0000000100000000000007Murrw. 1 postgres postgres 16777216 May 30 17:26 00000001000000000008drwxMurray. 2 postgres postgres 6 May 17 17:22 archive_status or something like that is greater than the maximum, so we can go to the-lumb000000010000000000000009murm parameter to add 1 to the maximum value under the pg_multixact/offsets directory and multiply the maximum value by 65536 (0x10000) and the minimum value multiplied by 65536 (0x10000) [postgres@lsl-test1 pg_commit_ts] $cd. / pg_multixact/offsets/ [Postgres @ lsl-test1 offsets] $ls-ltotal 8color rwxcompany. 1 postgres postgres 8192 May 17 18:04 0000

So-m can take 0x10000j0x00000.

When the-o parameter is uncertain, it can be ignored temporarily because the test does not copy the software.

-O find the file name with the largest number in the pg_multixact/members directory, + 1 times 52352 (0xCC80).

[postgres@lsl-test1 offsets] $cd.. / members/ [postgres@lsl-test1 members] $ls-ltotal 8 Murray RWX. 1 postgres postgres 8192 May 17 17:22 0000

So-O=0xCC80.

The-x parameter looks for the file name in the pg_xact directory where you can view the largest number, + 1 times 1048576 (0x100000).

[postgres@lsl-test1 members] $cd.. /. / pg_xact/ [Postgres @ lsl-test1 pg_xact] $ls-ltotal 16 RWX Murray. 1 postgres postgres 8192 May 17 18:04 00000 RWMI. 1 postgres postgres 8192 May 30 17:26 0001

So-x=0x200000.

You can view the contents of the parameters to be written to the control file without the-f parameter.

[postgres@lsl-test1 pg_xact] $/ usr/pgsql-11/bin/pg_resetwal-l 0000000100000000000009-m 0x10000pg_control exists but is broken or wrong version 0x00000-O 0xCC80-x 0x200000-D / pg/pg11/datapg_resetwal: oldest multitransaction ID (- m) must not be 0 [postgres@lsl-test1 pg_xact] $/ usr/pgsql-11/bin/pg_resetwal-l 00000001000000000009-m 0x10000men0x00001-O 0xCC80-x 0x200000-D / pg/pg11/datapg_resetwal: pg_control exists but is broken or wrong version Ignoring itGuessed pg_control values:pg_control version number: 1100Catalog version number: 201809051Database system identifier: 6696828635748080009Latest checkpoint's TimeLineID: 1Latest checkpoint's full_page_writes: offLatest checkpoint's NextXID: 0:3Latest checkpoint's NextOID: 10000Latest checkpoint's NextMultiXactId: 1Latest checkpoint's NextMultiOffset: 0Latest checkpoint's oldestXID: 3Latest checkpoint's oldestXID's DB: 0Latest checkpoint's oldestActiveXID: 0Latest checkpoint's oldestMultiXid: 1Latest checkpoint's oldestMulti's DB: 0Latest checkpoint's oldestCommitTsXid:0Latest checkpoint's newestCommitTsXid:0Maximum data alignment: 8Database block size: 8192Blocks Per segment of large relation: 131072WAL block size: 8192Bytes per WAL segment: 16777216Maximum length of identifiers: 64Maximum columns in an index: 32Maximum size of a TOAST chunk: 1996Size of a large-object chunk: 2048Date/time type storage: 64-bit integersFloat4 argument passing: by valueFloat8 argument passing: by valueData page checksum version: 0Values to be changed:First log segment after reset: 000000010000000000000009NextMultiXactId: 65536OldestMultiXid: 1OldestMulti's DB: 0NextMultiOffset: 52352NextXID: 2097152OldestXID: 2297064448OldestXID's DB: 0If these values seem acceptable Use-f to force reset. [postgres@lsl-test1 pg_xact] $cd.. / global/ [postgres@lsl-test1 global] $ls-l pg_control-rw-r--r--. 1 postgres postgres 0 May 30 17:36 pg_control

7. Start the database

Confirming that the parameters of the control file are correct and adding-f will be written to the control file.

[postgres@lsl-test1 global] $/ usr/pgsql-11/bin/pg_resetwal-l 000000010000000000000009-m 0x10000 0x00001-O 0xCC80-x 0x200000-D / pg/pg11/data-fpg_resetwal: pg_control exists but is broken or wrong version; ignoring itWrite-ahead log reset

Start the database.

[postgres@lsl-test1 global] $/ usr/pgsql-11/bin/pg_ctl start-D / pg/pg11/data/waiting for server to start....2019-05-30 22 CST 50.946 CST [2471] LOG: listening on IPv6 address ":: 1", port 54322019-05-30 22 22 V 42V 50.946 CST [2471] LOG: listening on IPv4 address "127.0.0.1" Port 54322019-05-30 22 LOG 50.949 CST [2471] LOG: listening on Unix socket "/ var/run/postgresql/.s.PGSQL.5432" 2019-05-30 22 22 LOG 50.961 CST [2471] LOG: listening on Unix socket "/ tmp/.s.PGSQL.5432" 2019-05-30 22 22 LOG: redirecting log output to logging collector process2019-05-30 22 22 redirecting log output to logging collector process2019: 50.987 CST [2471] HINT: Future log output will appear in directory "log" .doneserv er started

8. Check to see if the test data is normal, and then insert new data to see if the database is available.

[postgres@lsl-test1 global] $psqlpsql (11.2) Type "help" for help.postgres=# select min (oid), max (oid), count (*) from lsl_oid1; min | max | count-+-16400 | 116399 | 100000 (1 row) postgres=# insert into lsl_oid1 select generate_series; INSERT 0 100000postgres=# select min (oid), max (oid), count (*) from lsl_oid1 Min | max | count-+-+-16384 | 116399 | 200000 (1 row)

The database can be accessed normally.

So far, the content of the control file about Oracle and PostgreSQL is introduced here.

Want to know more about databases and cloud technologies?

Come and follow the official account of "data and Cloud" and the official website of "Yunhe Enmo". We look forward to learning and making progress with you!

(scan the QR code above and follow the official account of "data and Cloud" for more science and technology articles.)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report