backup

Oracle: file needs recovery (offline mode)

Tuesday, January 15th, 2008

SELECT d.file# f#, d.name, d.status, h.status
FROM v$datafile d, v$datafile_header h
WHERE d.file# = h.file#
AND (d.STATUS NOT IN (’SYSTEM’,'ONLINE’) OR h.STATUS != ‘ONLINE’ );

If there are such files, the recovery is necessary:

restore the file from the backup
recover datafile ‘&the_file_name’ ;
alter database datafile ‘&the_file_name’ online;

Another possibility (if there are a lot of files):

restore the files from the backup
recover [...]

List the tablespaces in backup mode

Wednesday, February 28th, 2007

Small query to list Oracle tablespaces, that are in backup mode:

SELECT d.tablespace_name, b.time
FROM dba_data_files d, v$backup b
WHERE
d.file_id = b.FILE#
AND b.STATUS = ‘ACTIVE’ ;

Automatic MySQL backup script

Wednesday, March 15th, 2006

#!/bin/bash
#
# MySQL Backup Script
# VER. 2.5 - http://sourceforge.net/projects/automysqlbackup/
# Copyright (c) 2002-2003 wipe_out@lycos.co.uk
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program [...]

Keep on coding