10g rac安装注意事项

1、配置ip地址不要忘记网关
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.100.255
HWADDR=00:0C:29:28:8F:AC
IPADDR=192.168.100.101
NETMASK=255.255.255.0
NETWORK=192.168.100.0
ONBOOT=yes
TYPE=Ethernet
GATEWAY=192.168.100.1

2、域名解析不要忘记了localhost
127.0.0.1 localhost
192.168.100.101 node1
192.168.100.102 node2
192.168.100.201 node1-vip
192.168.100.202 node2-vip
10.10.17.221 node1-priv
10.10.17.222 node2-priv

3、重新安装处理
rm -f /etc/init.d/init.cssd
rm -f /etc/init.d/init.crs
rm -f /etc/init.d/init.crsd
rm -f /etc/init.d/init.evmd
rm -f /etc/rc2.d/K96init.crs
rm -f /etc/rc2.d/S96init.crs
rm -f /etc/rc3.d/K96init.crs
rm -f /etc/rc3.d/S96init.crs
rm -f /etc/rc5.d/K96init.crs
rm -f /etc/rc5.d/S96init.crs
rm -rf /etc/oracle/scls_scr
rm -f /etc/inittab.crs
rm -rf /u01/oraInventory
rm -rf /u01/app/crs
rm -rf /etc/ora*
rm -rf /etc/init.d/init.*
rm -f /usr/local/bin/*
rm -rf /opt/ORCLfmap
rm -rf /opt/oracle/admin
dd if=/dev/null of=/dev/raw/raw2 bs=209715200 count=1
dd if=/dev/null of=/dev/raw/raw1 bs=104857600 count=1
dd if=/dev/null of=/dev/raw/raw3 bs=1232896 count=1000
dd if=/dev/null of=/dev/raw/raw4 bs=1232896 count=1000
Note:dd操作效果不好,可以在执行root.sh到Startup will be queued to init within 90 seconds.挂起后,执行$CRS_HOME/install/rootdeinstall.sh,然后再执行root.sh

4、因内网ip地址不能被自动添加到vip中处理
出现现象:
Checking existence of VIP node application (required)
Check failed.
Check failed on nodes:
node2,node1
解决:使用root账户运行图画界面vipca,手工添加vip的域名和地址

5、remote_listener和tns名称一致
show parameter remote_listener
NAME TYPE VALUE
———————————— ———– ————-
remote_listener string LISTENERS_XFF
tnsnames.ora

LISTENERS_XFF =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.201)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.202)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = xff)
)
)

6、各个节点时间一致
选择一种一个为时间参考节点
[root@node1 bin]# cat /etc/ntp.conf
server 127.127.1.0
fudge 127.127.1.0 stratum 11
driftfile /var/lib/ntp/drift
broadcastdelay 0.008

其他节点同步该时间
[root@node2 bin]# crontab -l
*/15 * * * * ntpdate node1

均开启ntpd服务
service ntpd start
chkconfig ntpd on

wordpress中常用sql语句

开启所有评论
UPDATE wp_posts
SET comment_status = ‘open’
WHERE post_status = ‘publish’;

关闭旧文章的留言
UPDATE wp_posts
SET comment_status = ‘closed’
WHERE post_date < '2009-01-01' AND post_status = 'publish' 删除所有的垃圾评论
DELETE FROM wp_comments
WHERE comment_approved = ‘spam’

删除所有文章修订版本(Revisions)以及它们的Meta数据
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = ‘revision’

清理wp_postmeta表
DELETE FROM wp_postmeta WHERE meta_key = ‘_wp_old_slug’;
DELETE FROM wp_postmeta WHERE meta_key = ‘_revision-control’;
DELETE FROM wp_postmeta WHERE meta_value = ‘{{unknown}}’;

写成shell脚本,添加表优化,可以使用crontab定时调用处理
执行shell

mysql解锁

一、查看进程运行情况(会话1)
mysql> select id,user,host,db,command,time,state from processlist a;
+—-+——+—————–+——————–+———+——+———–
+
| id | user | host | db | command | time | state
|
+—-+——+—————–+——————–+———+——+———–
+
| 40 | root | localhost:14046 | information_schema | Query | 0 | executing
|
| 39 | root | localhost:13992 | chf | Sleep | 251 |
|
| 38 | root | localhost:13991 | chf | Sleep | 251 |
|
+—-+——+—————–+——————–+———+——+———–
+
3 rows in set (0.00 sec)

二、构造表被锁现象
1)锁住表(会话1)
mysql>LOCK TABLES chf.disc02 READ;或者–LOCK TABLES chf.disc02 WRITE;
2)执行dml操作(会话2)
mysql>delete from chf.disc02 limit 1;–会话处于卡死状态
3)查询进程运行情况(会话1)
mysql> select id,user,host,db,command,time,state from processlist a;
+—-+——+—————–+——————–+———+——+———–
+
| id | user | host | db | command | time | state
|
+—-+——+—————–+——————–+———+——+———–
+
| 41 | root | localhost:14358 | chf | Query | 5 | Locked
|
| 40 | root | localhost:14046 | information_schema | Query | 0 | executing
|
| 39 | root | localhost:13992 | chf | Sleep | 343 |
|
| 38 | root | localhost:13991 | chf | Sleep | 343 |
|
+—-+——+—————–+——————–+———+——+———–
+
4 rows in set (0.01 sec)

说明:发现进程id为41的进程状态为Locked

三、解锁操作
1)删掉被锁进程(会话1)
mysql> kill 41;
出现现象(会话2)
ERROR 2013 (HY000): Lost connection to MySQL server during query

2)查看进程(会话1)
mysql> select id,user,host,db,command,time,state from processlist a;
+—-+——+—————–+——————–+———+——+———–
+
| id | user | host | db | command | time | state
|
+—-+——+—————–+——————–+———+——+———–
+
| 40 | root | localhost:14046 | information_schema | Query | 0 | executing
|
| 39 | root | localhost:13992 | chf | Sleep | 298 |
|
| 38 | root | localhost:13991 | chf | Sleep | 298 |
|
+—-+——+—————–+——————–+———+——+———–
+
3 rows in set (0.01 sec)

四、批量解锁
mysql> select concat(‘kill ‘,id,’;’) kill_process from processlist a where a.state=’Locked’;
+————–+
| kill_process |
+————–+
| kill 43; |
| kill 42; |
+————–+
2 rows in set (0.01 sec)

Note:
1)可以使用show processlist查看当前用户连接
如果是root帐号,你能看到所有用户的当前连接。如果是其它普通帐号,只能看到自己占用的连接。show processlist;只列出前100条,如果想全列出请使用show full processlist;
2)在构造锁的会话中,使用unlock tables;也可以解锁

ASMCMD常用命令

1、显示指定的ASM目录下ASM文件占用的所有磁盘空间
du

2、列出ASM目录下的内容及其属性
ls -ls

3、查看当前路径
pwd

4、打开目录
cd ../DATA

5、列出当前ASM客户端的信息
lsct

6、列出所有磁盘组及其属性
lsdg

7、列出数据文件信息
lsof

8、列出盘的信息
lsdsk

Note:大小写敏感

ASM简单管理(1)

一、ASM磁盘和磁盘组管理
1、创建磁盘组
create diskgroup DG2 EXTERNAL REDUNDANCY DISK ‘ORCL:A1’;
Note:1)磁盘名称需要大写
2)磁盘名称使用V$asm_disk.path

2、磁盘组中添加磁盘
alter diskgroup dg2 add disk ‘ORCL:A2’;
Note:磁盘名称使用V$asm_disk.path

3、磁盘组中删除磁盘
alter diskgroup dg2 drop disk ‘a1’;
Note:磁盘名称使用的是V$asm_disk.name

4、删除磁盘组
drop diskgroup dg2 including contents;

二、ASM相关视图
1、查看是否有数据库实例连接上ASM实例
select instance_name,db_name,status from v$asm_client;

2、记录BALANCE操作
select operation,state,power,actual,sofar from v$asm_operation;

3、ASM DISK信息
select path, state, total_mb, free_mb from v$asm_disk;

4、ASM DISKGROUP信息
select name,state,type,total_mb,free_mb from v$asm_diskgroup;

三、ASM和表空间管理
1、ASM中创建表空间
create tablespace xff datafile ‘+DG2’ SIZE 100M;

2、ASM表空间中添加数据文件
alter tablespace xff add datafile ‘+dg2’ size 10m;

3、ASM表空间中删除数据文件
alter tablespace xff drop datafile ‘+DG2/xff/datafile/xff.257.747278679’;
或者
alter tablespace xff drop datafile 7;

4、删除表空间
drop tablespace xff including contents;