DB分類文章 顯示方式:簡文 | 列表

2006年01月25日

MySQL的mysqlhotcopy script


#!/bin/bash
DB_NAME=資料名字
DB_LOGIN=登入的帳號
DB_PASSWORD=登入的密碼
BACK_FOLDER=備份的目錄
DATE=`date +%Y%m%d`
BACK_HOME="$BACK_FOLDER"/"$DATE"

mkdir -p $BACK_HOME
mysqlhotcopy -u $DB_LOGIN -p $DB_PASSWORD $DB_NAME $BACK_HOME
#保留十四天內的資料
find $BACK_HOME -mtime +14 -exec rm -rf {} \; ...繼續閱讀

Posted by my_work at 樂多Roodo!11:32回應(0)引用(0)

安裝perl DBI::mysql要注意的地方

因為使用mysqlhotcopy需要DBD::mysql的函數庫,但我用cpan一直失敗,後來上google找到方法了

export LANG=C

perl Makefile.PL --testdb=資料庫 --testuser=使用者 --testpassword=密碼

再來 make 之後就完工了。



# make

# make test

# make install

 
...繼續閱讀

Posted by my_work at 樂多Roodo!11:02回應(0)引用(0)

2006年01月24日

改機器名字跟ip時mysql要注意的地方


更改機器名字和ip時,mysql有可能出現無法連入,這時把host改成正確的資料,不然就把host的值改成%,那就可了
 
...繼續閱讀

Posted by my_work at 樂多Roodo!11:58回應(0)引用(0)

2006年01月23日

oracle的expdb.script

#!/bin/bash
export HOME=/home/oracle/
export PWD=$HOME
. $HOME/.bash_profile
export LANG=en

# oracle backup_expdp_dir as /u01/expdp/

EXPDP=/u01/app/oracle/product/10.1.0/db_1/bin/expdp
DATE=`date +%Y_%m_%d_%k_%M`
LOGFILE="$DATE"_dump.log
SCHEMAS=expdb
DIRECTORY=backup_expdp_dir
DUMPFILE="$ORACLE_SID"_"$DATE".dump

"$EXPDP" 帳號/密碼@apmdb schemas="$SCHEMAS" directory="$DIRECTORY" dumpfile="$DUMPFILE" logfile="$LOGFILE" job_name=cases_export parallel=4

 
...繼續閱讀

Posted by my_work at 樂多Roodo!14:42回應(1)引用(0)

oracle使用script每日寄送log

#!/bin/bash
ACCESS_LOG=alert.log
HOME=/u01/app/oracle/admin/orcl/bdump
BACKUP="$HOME"/backup
DATE=`date +%Y%m%d`
ACCESS_BACKUP="$BACKUP"/"$ACCESS_LOG"
if [ -f "$HOME"/"$ACCESS_LOG" ] ; then
  cat "$HOME"/"$ACCESS_LOG" | mail dba@orcl.com -s db_"$DATE"
  cat "$HOME"/"$ACCESS_LOG" >> "$BACKUP"/"$ACCESS_LOG"."$DATE"
  date > "$HOME"/"$ACCESS_LOG"
fi

find $BACKUP -mtime +30 -type f -exec rm {} \;
 
...繼續閱讀

Posted by my_work at 樂多Roodo!11:03回應(0)引用(0)

2006年01月18日

oracle安裝手冊link

做個link的筆記,以免每次要安裝時還要再找一下
http://www.puschitz.com/InstallingOracle10g.shtml
 
...繼續閱讀

Posted by my_work at 樂多Roodo!0:03回應(0)引用(0)

2006年01月17日

Oracle的備份跟還原(catalog)


這是測試環境,正式環境請把rman db建立在另一台db上面
1、建立rman db流程
[oracle@t1 backup]$ sqlplus /nolog

SQL*Plus: Release 10.1.0.2.0 - Production on Wed Dec 28 11:34:11 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

SQL> conn / as sysdba
Connected.
SQL> create tablespace rman_db datafile '/u01/app/oracle/apmdb/rman_db.dbf' size 50M;

Tablespace created.

SQL> create user RMAN identified by RMAN default tablespace rman_db temporary tablespace temp;

User created.


SQL> grant connect,resource,recovery_catalog_owner,create any directory to rman;

Grant succeeded.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

[oracle@t1 backup]$ rman target / catalog rman/rman@apmdb

Recovery Manager: Release 10.1.0.2.0 - Production

Copyright (c) 1995, 2004, Oracle. All rights reserved.

connected to target database: APMDB (DBID=2891684270)
connected to recovery catalog database
recovery catalog is not installed

RMAN> create catalog tablespace rman_db;

recovery catalog created

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

 
...繼續閱讀

Posted by my_work at 樂多Roodo!17:00回應(8)引用(1)
 [第一頁]  [上10頁]  [12]  [13]  [14]