当前位置:网站首页>Dameng database backup and restore

Dameng database backup and restore

2022-06-26 04:29:00 good writings make people copy them

There are two types of backup : Physical and logical backup .

The physical backup What is backed up is the data page that has been used effectively , Operating system physical files for the database ( Such as data files 、 Control files and log files, etc ).

Logical backup The main backup objects are database objects ( surface 、 View 、 Index, etc. ), Logical backup can be used for data migration , Historical data archiving .

1.1 Physical backup restore

Physical backup is also divided into offline backup ( Cold standby ) And online backup ( Hot standby ) Two backup methods .

Cold standby (DmAPService It's open , The database is closed )
Hot standby (DmAPService It's open , The database is open , The database should be opened for archiving )

1. Cold standby

There are two ways of cold standby :console Tools 、dmrman Tools

(1)console Tool backup

   **1. determine DmAPService Open or not

[[email protected] bin]$ ./DmAPService status
DmAPService (pid 22440) is running.

   **2. Close the database

[[email protected] bin]$ ./DmServiceDMSERVER stop
Stopping DmServiceDMSERVER:                                [ OK ]

**3. Create a backup folder

[[email protected] dm8]$ mkdir -p backup
[[email protected] dm8]$ ls
backuo  data     include         license_zh.txt  tool
backup  desktop  jar             log             uninstall
bin     doc      jdk             samples         uninstall.sh
bin2    drivers  license_en.txt  script          web

**4. Backup started  

[[email protected] tool]$ ./console

(Console:78964): GLib-GObject-WARNING **: 04:21:04.900: invalid (NULL) pointer instance

(Console:78964): GLib-GObject-CRITICAL **: 04:21:04.900: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(Console:78964): Gtk-CRITICAL **: 04:21:04.900: IA__gtk_settings_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(Console:78964): Gtk-WARNING **: 04:21:04.909: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(Console:78964): Gtk-WARNING **: 04:21:04.909: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_screen_get_display: assertion 'GDK_IS_SCREEN (screen)' failed

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_display_get_pointer: assertion 'GDK_IS_DISPLAY (display)' failed

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_screen_get_monitor_at_point: assertion 'GDK_IS_SCREEN (screen)' failed

(Console:78964): Gtk-WARNING **: 04:21:04.909: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_screen_get_n_monitors: assertion 'GDK_IS_SCREEN (screen)' failed

(Console:78964): Gtk-WARNING **: 04:21:04.909: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_screen_get_monitor_geometry: assertion 'GDK_IS_SCREEN (screen)' failed

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_screen_get_default_colormap: assertion 'GDK_IS_SCREEN (screen)' failed

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_colormap_get_visual: assertion 'GDK_IS_COLORMAP (colormap)' failed

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_screen_get_default_colormap: assertion 'GDK_IS_SCREEN (screen)' failed

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed

(Console:78964): Gdk-CRITICAL **: 04:21:04.909: IA__gdk_window_new: assertion 'GDK_IS_WINDOW (parent)' failed
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f237dcb32c7, pid=78964, tid=139790923097856
#
# JRE version: OpenJDK Runtime Environment (8.0_20-b26) (build 1.8.0_20-b26)
# Java VM: OpenJDK 64-Bit Server VM (25.20-b23 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libgdk-x11-2.0.so.0+0x7b2c7]  gdk_window_enable_synchronized_configure+0x7
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /dm8/tool/hs_err_pid78964.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
./console:  That's ok  17: 78964  Has given up                ( spit out the pips )"$JAVA_HOME/bin/java" -XX:+PerfDisableSharedMem -DDM_HOME="$DM_HOME" -Djava.library.path="$DM_HOME/bin" -Ddameng.log.file="$TOOL_HOME/log4j.xml" -DeclipseHome="$TOOL_HOME" -Dosgi.nl="$INSTALL_LANGUAGE" -Ddameng.dts.explorer.root="$TOOL_HOME/workspace/local/dts" -Ddameng.isql.explorer.root="$TOOL_HOME/workspace/local/isql" -Duse_bak2=true -Dapp.name=console -jar "$TOOL_HOME/plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar" -os linux -ws gtk -arch x86_64 -showsplash "$TOOL_HOME/console.bmp" -data "$TOOL_HOME/workspace/console" -product com.dameng.console.product -name Console

Once this problem is found , It is also the reason why the graphical interface cannot be opened , First, solve the problem of opening the graphical interface

[[email protected] ~]$ echo $DISPLAY
localhost:11.0
[[email protected] ~]$ export DISPLAY=localhost:11.0
[[email protected] ~]$ xhost +
access control disabled, clients can connect from any host

good , Continue the backup :

 

  Click ok , Backup success .


The difference between a full backup and an incremental backup :

Full backup : A full backup is a backup that contains all the data in a specified database or table space

Incremental backup : Incremental backup refers to a backup or the last incremental backup , Each backup in the future only needs files that have been added or modified compared with the previous backup


(2)dmrman Tool backup

[[email protected] tool]$ cd /dm8/bin 
[[email protected] bin]$ ./dmrman 
RMAN> backup database '/dm8/data/DAMENG/dm.ini' backupset '/dm8/backup';

2. Hot standby

There are two ways of hot standby :manager Tools disql Tools

(1)manager

 **1. determine DmAPService Open or not

[[email protected] bin]$ ./DmAPService status
DmAPService (pid 22440) is running.

  **2. Determine whether the database is open

[[email protected] bin]$ ./DmServiceDMSERVER start
DmServiceDMSERVER (pid 7878) is running.

  **3. Determine whether to open the archive

[[email protected] bin]$ ./disql
disql V8
 user name :sysdba
 password :

 The server [LOCALHOST:5236]: In the normal open state 
 Login usage time  : 3.916(ms)
SQL> select name,arch_mode from v$database;

 Line number      NAME   ARCH_MODE
---------- ------ ---------
1          DAMENG N

 Elapsed time : 1.735( millisecond ).  Executive number :1700.

  Use manager Tool open archive

[[email protected] bin]$ mkdir -p /dm8/arch
[[email protected] bin]$ cd ../tool
[[email protected] tool]$ ./manager

 

 

  **4. Backup started

3. Restore

First check the validity of the backup set

MAN> check backupset '/dm8/backup'
check backupset '/dm8/backup'
check backupset successfully.
time used: 13.518(ms)

**1. Close database instance

[[email protected] tool]$ cd ../bin
[[email protected] bin]$ ./DmServiceDMSERVER stop
Stopping DmServiceDMSERVER:                                [ OK ]

**2. Through the tool (console) Or order (dmrman) To restore ( Let's say console To restore )


Restore : Is to copy the database at a certain point in time ( Backup ) Copy to the corresponding directory

recovery : After the database restore , Apply some or all of the archived logs


**3. Use archived logs for recovery

**4. to update DB_Magic( Once updated DB_Magic, Backup is useless )

1.1 Logical backup recovery

        Damon database logical backup tool can perform database level backup on local or remote databases 、 Logical backup at mode level and table level . The backup content is very flexible , You can choose whether to back up the index 、 Data rows and permissions , Whether to ignore various constraints ( Foreign key constraints 、 Non empty constraint 、 Unique constraints, etc ).

Logical backup restore is divided into these levels :( Popular speaking , you are here manager Under the tool , The mode selected for export under mode is the mode level , The user you select to export under user is the user mode .)
  • Library level
  • User level
  • Mode level
  • Table level

  Here is an example of the library level :

1. Backup

2. recovery

 

原网站

版权声明
本文为[good writings make people copy them]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202180531084517.html