Thursday, September 29, 2011
rsync 增量备份
[cc lang="text"]rsync --force --ignore-errors --delete --delete-excluded --exclude "logs/" --exclude "umslog/" 192.168.254.221::www-back /Datas/Backup/Rsync-YuKuai/app-daily --log-file=/Datas/Backup/Rsync-YuKuai/logs/`date +%Y-%m-%d`.log -azv -backup --backup-dir=/Datas/Backup/Rsync-YuKuai/app-daily-arch/`date +%Y-%m-%d`[/cc]
Monday, September 19, 2011
thinkpad只插电源适配器会锁频
在Gentoo上捣鼓 cpufreq-info 时发现只插电源适配器会锁频,可能是电源适配器只有65W 的原因。
Monday, September 12, 2011
Cloud computing software
Cloud computing related open source softwares. IAAS: OpenNebula , OpenStack , Eucalyptus, CloudForms, CloudStack/Cloud.com(part of cloudstack), ibvirt, AbiCloud, Nimbus, OpenNebula, OpenQRM, ConVirt, OpenVZ ; PAAS:Makara/OpenShift, Cloud Foundry,Aeolus(iPaaS) , AppScale, CloudStack.
Thursday, September 8, 2011
使用expect自动登录SSH脚本
[cc lang="bash"]#!/usr/bin/expect -f
set server [lindex $argv 0]
trap {
set rows [stty rows]
set cols [stty columns]
stty rows $rows columns $cols < $spawn_out(slave,name)
} WINCH
switch -- $server \
"mail" {
spawn ssh -p 51 root@mail
expect "password:"
send "A)Q11dDuh^.\n"
interact
} "win1" {
exec rdesktop -u administrator -p "aU\$B_C%K" 192.168.111.3
} default {
puts "input a server name"
}
expect eof[/cc]
set server [lindex $argv 0]
trap {
set rows [stty rows]
set cols [stty columns]
stty rows $rows columns $cols < $spawn_out(slave,name)
} WINCH
switch -- $server \
"mail" {
spawn ssh -p 51 root@mail
expect "password:"
send "A)Q11dDuh^.\n"
interact
} "win1" {
exec rdesktop -u administrator -p "aU\$B_C%K" 192.168.111.3
} default {
puts "input a server name"
}
expect eof[/cc]
Friday, September 2, 2011
AWR报告生成
一.生成AWR报告
[cce lang='text' line_numbers='false'][ractest@sun880-1 /u01/app/oracle/orahome/rdbms/admin]$ cd $ORACLE_HOME/rdbms/admin
[ractest@sun880-1 /u01/app/oracle/orahome/rdbms/admin]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jan 27 20:47:38 2008
Copyright (c) 1982, 2007, Oracle. All Rights Reserved/span>.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> @awrrpt
......[/cce]
//根据Oracle提示生成报告......
注:报告生成在[cci]$ORACLE_HOME/rdbms/admin/[/cci]目录下。
二.修改awr的默认设置
//半小时采集一次,采集信息保存3天。
[cce lang='sql' line_numbers='false']SQL>exec dbms_workload_repository.modify_snapshot_settings (interval=>30,retention =>3*24*60);[/cce]
三.关闭AWR自动收集
[cce lang='sql' line_numbers='false']SQL>exec dbms_workload_repository.modify_snapshot_settings (interval=>0,retention =>24*60);[/cce]
注:10g默认是自动开启awr信息收集的,会对系统有一定的影响(很小);如果要关闭awr信息收集,只需设置interval参数为0即可。但interval设0后,AWR报告无法生成。
Oracle常用命令
一.基础SQL语句
- 查:select * from employees;
- 增:insert into employees (Name , Birthday , Location , Salary) values ('hyddd','1984-10-1','guangzhou',999999);
- 改:update employees set Salary=999999999 where Name='hyddd';
- 删:delete from employees where name='zhangsan';
更多技巧请参考:SQL基本语句
二.PFile,SPFile管理
- SPFile->PFile:
##用生成对应SID的spfile生成pfile,生成的pfile位置:$ORACLE_HOME/dbs/init$ORACLE_SID.ora
SQL> create pfile from spfile;
--------
##自己指定生成文件的位置
SQL> create pfile='/home/oracle/initorcl.ora' from spfile;- PFile->SPFile
SQL> create spfile from pfile;
三.启动,关闭数据库
- 启动
SQL>startup
- 关闭
SQL>shutdown normal
SQL>shutdown transactional
SQL>shutdown immediate
SQL>shutdown abort
四.修改SGA参数
- 修改SGA的原则
- sga_target <= sga_max_size
- SGA加上PGA等其他进程占用的内存必须少于机器物理内存。
- 命令
SQL>alter system set sga_max_size=2048m scope=spfile;
SQL>alter system set sga_target=2048m scope=spfile;
##修改SGA的相关参数,只能spfile,然后重启数据库。不能直接scope=both!
五.查询Oracle配置参数
- 命令
SQL>show parameter;
- 具体查询某个Oracle参数,只需输入部分关键字即可,比如:查询sga_target的值。
SQL> show parameter sga;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 2G
sga_target big integer 2G
SQL>
Thursday, September 1, 2011
用virt-install克隆一个复制来的镜像
[cc lang='bash' line_numbers='false']virt-install qemu:///system --name vCentOS-Base --ram 2048 --cpuset=1,3,5 and 7 --accelerate --disk path=/Datas/V-Host/vCentOS-Base --import --network bridge:br0[/cc]
CentOS 5.6上的[cci lang='bash' line_numbers='false']virt-clone[/cci]有点问题,就直接用[cci lang='bash' line_numbers='false']copy[/cci]来复制然后用virt-install导入。
CentOS 5.6上的[cci lang='bash' line_numbers='false']virt-clone[/cci]有点问题,就直接用[cci lang='bash' line_numbers='false']copy[/cci]来复制然后用virt-install导入。
Subscribe to:
Posts (Atom)