(8.0.21)
mkdir db_backup
cd db_backup
vim /etc/my.cnf
[mysqldump]
user = root
password = root
vim db_backup.sh
#!/bin/sh
mysqldump test --quick --master-data=2 --flush-logs --single-transaction --triggers --routines --events > /root/db_backup/db_backup.dmp
exit 0
chmod +x db_backup.sh
-- リストア確認
mysql test < /root/db_backup/db_backup.dmp
(19c)
mkdir db_backup
cd db_backup
vim db_backup.rman
list backup;
crosscheck backup;
backup database plus archivelog;
delete noprompt expired backup;
delete noprompt obsolete;
vim db_backup.sh
#!/bin/sh
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
export PATH=$ORACLE_HOME/bin:${PATH}
export NLS_LANG=JAPANESE_JAPAN.AL32UTF8
export ORACLE_SID=orcl
rman target / @/home/oracle/db_backup/db_backup.rman log=/home/oracle/db_backup/db_backup.log
exit 0
chmod +x db_backup.sh
-- リストア確認
rman target /
restore database;
recover database;
alter database open;
(13)
mkdir db_backup
cd db_backup
vim db_backup.sh
#!/bin/sh
pg_dump -Fp --clean --create test > /var/lib/pgsql/db_backup/db_backup.dmp
exit 0
chmod +x db_backup.sh
-- リストア確認
/usr/pgsql-13/bin/oid2name
/usr/pgsql-13/bin/oid2name -d test -i
psql < /var/lib/pgsql/db_backup/db_backup.dmp
(2019)
mkdir db_backup
cd db_backup
notepad db_backup.sql
use test;
go
backup database test
to disk = 'C:\db_backup\test.bak'
with format,
medianame = 'test',
name = 'database backup of test';
notepad db_backup.bat
sqlcmd -i C:\db_backup\db_backup.sql > C:\db_backup\db_backup.log 2>&1
-- リストア確認
use master
go
restore database test
from DISK = 'C:\db_backup\test.bak'
with recovery;