Backup and Mount DB in 1 Minute

In this tutorial, you will learn how to backup database, mount database and retrieve data from a mounted database.

Step 1 : Backup sample_table from Machbase.

[mach@localhost ~]$ machsql -s localhost -u sys -p manager
=================================================================
     Machbase Client Query Utility
     Release Version 3.5.0.826b8f2
     Copyright 2014 Machbase Inc or its subsidiaries.
     All Rights Reserved.
=================================================================
MACHBASE_CONNECT_MODE=INET, PORT=5656
Type 'help' to display a list of available commands.

Mach> BACKUP TABLE sample_table INTO DISK = 'backup_sample_table';
Mach> quit

Step 2 : check the backup file

cd $MACHBASE_HOME/dbs
ls -l backup_sample_table

Step 3 : mount the backup database.

[mach@localhost ~]$ machsql -s localhost -u sys -p manager
=================================================================
     Machbase Client Query Utility
     Release Version 3.5.0.826b8f2
     Copyright 2014 Machbase Inc. or its subsidiaries.
     All Rights Reserved.
=================================================================
MACHBASE_CONNECT_MODE=INET, PORT=5656
Type 'help' to display a list of available commands.


Mach> MOUNT DATABASE 'backup_sample_table' TO sampledb;
Executed successfully.
Elapsed time: 0.017
Mach> SELECT MOUNTDB, PATH FROM V$STORAGE_MOUNT_DATABASES;
MOUNTDB
------------------------------------------------------------------------------------
PATH
------------------------------------------------------------------------------------
SAMPLEDB
/home/machbase/machbase_home/dbs/backup_sample_table
[1] row(s) selected.
Elapsed time: 0.000

Step 4 : retrieve data from Machbase

Mach> DESC SAMPLEDB.SYS.SAMPLE_TABLE;
[ COLUMN ]
----------------------------------------------------------------
NAME                          TYPE                LENGTH
----------------------------------------------------------------
SRCIP                         ipv4                15
SRCPORT                       integer             11
DSTIP                         ipv4                15
DSTPORT                       integer             11
PROTOCOL                      short               6
EVENTLOG                      varchar             1204
EVENTCODE                     short               6
EVENTSIZE                     long                20

Mach> SELECT COUNT(*) FROM SAMPLEDB.SYS.SAMPLE_TABLE;

COUNT(*)
-----------------------
1000000
[1] row(s) selected.
Elapsed time: 0.000
Mach>

Step 5 : unmount database

Mach> UNMOUNT DATABASE sampledb;
Executed successfully.
Elapsed time: 0.000 

Mach> SELECT MOUNTDB, PATH FROM V$STORAGE_MOUNT_DATABASES;
MOUNTDB
------------------------------------------------------------------------------------
PATH
------------------------------------------------------------------------------------
[0] row(s) selected.
Elapsed time: 0.000
Mach>

results matching ""

    No results matching ""