MYSQL小白的FAQ系列—-4—-使用rpm包安装后,如何卸载干净mysql?

首先卸载mysql组件:

[root@lunar ~]# rpm -aq|grep -i mysql
MySQL-server-advanced-5.6.21-1.rhel5      ---MySQL Server的rpm包
MySQL-test-advanced-5.6.21-1.rhel5        ---MySQL的test测试库
MySQL-client-advanced-5.6.21-1.rhel5       ----MySQL客户端
MySQL-embedded-advanced-5.6.21-1.rhel5     -----MySQL嵌入式开发包
MySQL-devel-advanced-5.6.21-1.rhel5        ---MySQL开发依赖包
MySQL-shared-advanced-5.6.21-1.rhel5
MySQL-shared-compat-advanced-5.6.21-1.rhel5
[root@lunar ~]# rpm -e MySQL*
error: package MySQL* is not installed
[root@lunar ~]# rpm -e MySQL-server-advanced-5.6.21-1.rhel5
[root@lunar ~]# rpm -e MySQL-test-advanced-5.6.21-1.rhel5
[root@lunar ~]# rpm -e MySQL-client-advanced-5.6.21-1.rhel5
[root@lunar ~]# rpm -e MySQL-embedded-advanced-5.6.21-1.rhel5
[root@lunar ~]# rpm -e MySQL-devel-advanced-5.6.21-1.rhel5
[root@lunar ~]# rpm -e MySQL-shared-advanced-5.6.21-1.rhel5
[root@lunar ~]# rpm -e MySQL-shared-compat-advanced-5.6.21-1.rhel5
[root@lunar ~]# rpm -qa|grep -i mysql
[root@lunar ~]# 

如果删除不掉,可以使用–nodeps参数,即防止互相依赖不能删除的情况
例如:rpm -e –nodeps MySQL-server-advanced-5.6.21-1.rhel5

然后清理mysql的配置文件,一般在/etc或者/usr下面:

[root@lunar ~]# ll /etc|grep my
[root@lunar ~]# ll /var|grep my
[root@lunar ~]# ll /usr|grep my
-rw-r--r--   1 root root   943 Aug  3 13:53 my.cnf
[root@lunar ~]# mv /usr/my.cnf /usr/my.cnf.bak
[root@lunar ~]# 

最后清理mysql的数据库目录:

[root@lunar ~]# cd /var/lib
[root@lunar lib]# ll mysql
total 110764
-rw-rw---- 1 mysql mysql       56 Aug  3 14:29 auto.cnf
-rw-rw---- 1 mysql mysql 12582912 Aug  3 15:45 ibdata1
-rw-rw---- 1 mysql mysql 50331648 Aug  3 15:45 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 Aug  3 13:53 ib_logfile1
drwx------ 2 mysql mysql     4096 Aug  3 15:14 lunardb
-rw-r----- 1 mysql root     17522 Aug  3 15:45 lunar.err
drwx--x--x 2 mysql mysql     4096 Aug  3 13:53 mysql
-rw-rw-r-- 1 mysql mysql       85 Aug  3 14:40 payload.c
drwx------ 2 mysql mysql     4096 Aug  3 13:53 performance_schema
-rw-r--r-- 1 root  root       115 Aug  3 13:53 RPM_UPGRADE_HISTORY
-rw-r--r-- 1 mysql mysql      115 Aug  3 13:53 RPM_UPGRADE_MARKER-LAST
drwxr-xr-x 2 mysql mysql     4096 Aug  3 13:53 test
[root@lunar lib]# rm -rf /var/lib/mysql
[root@lunar lib]# 

清理其他配置文件(字符集和一些配置脚本):

[root@lunar mysql]# cd /usr/share/mysql
[root@lunar mysql]# ls
binary-configure  dictionary.txt   fill_help_tables.sql  innodb_memcached_config.sql  my-default.cnf               mysql_system_tables_data.sql  polish      serbian
bulgarian         dutch            french                italian                      mysqld_multi.server          mysql_system_tables.sql       portuguese  slovak
charsets          english          german                japanese                     mysql-log-rotate             mysql_test_data_timezone.sql  romanian    spanish
czech             errmsg-utf8.txt  greek                 korean                       mysql_security_commands.sql  norwegian                     russian     swedish
danish            estonian         hungarian             magic                        mysql.server                 norwegian-ny                  SELinux     ukrainian
[root@lunar mysql]# 

清理一下mysql的相关命令:

[root@lunar mysql]# ll /usr/bin|grep -i mysql
-rwxr-xr-x 1 root root         930 Sep 11  2014 msql2mysql
-rwxr-xr-x 1 root root     8299942 Sep 11  2014 mysql
-rwxr-xr-x 1 root root      111136 Sep 11  2014 mysqlaccess
-rw-r--r-- 1 root root        1702 Sep 11  2014 mysqlaccess.conf
-rwxr-xr-x 1 root root     7320299 Sep 11  2014 mysqladmin
-rwxr-xr-x 1 root root     8121731 Sep 11  2014 mysqlbinlog
-rwxr-xr-x 1 root root       11019 Sep 11  2014 mysqlbug
-rwxr-xr-x 1 root root     7300011 Sep 11  2014 mysqlcheck
-rwxr-xr-x 1 root root     8366903 Sep 11  2014 mysql_client_test
-rwxr-xr-x 1 root root    73110360 Sep 11  2014 mysql_client_test_embedded
-rwxr-xr-x 1 root root        6223 Sep 11  2014 mysql_config
-rwxr-xr-x 1 root root     5843349 Sep 11  2014 mysql_config_editor
-rwxr-xr-x 1 root root        3714 Sep 11  2014 mysql_convert_table_format
-rwxr-xr-x 1 root root       25749 Sep 11  2014 mysqld_multi
-rwxr-xr-x 1 root root       24691 Sep 11  2014 mysqld_safe
-rwxr-xr-x 1 root root     7536459 Sep 11  2014 mysqldump
-rwxr-xr-x 1 root root        6817 Sep 11  2014 mysqldumpslow
-rwxr-xr-x 1 root root    72920866 Sep 11  2014 mysql_embedded
-rwxr-xr-x 1 root root        2789 Sep 11  2014 mysql_find_rows
-rwxr-xr-x 1 root root         726 Sep 11  2014 mysql_fix_extensions
-rwxr-xr-x 1 root root       34331 Sep 11  2014 mysqlhotcopy
-rwxr-xr-x 1 root root     7310676 Sep 11  2014 mysqlimport
-rwxr-xr-x 1 root root       34014 Sep 11  2014 mysql_install_db
-rwxr-xr-x 1 root root     5775748 Sep 11  2014 mysql_plugin
-rwxr-xr-x 1 root root        9523 Sep 11  2014 mysql_secure_installation
-rwxr-xr-x 1 root root     7290946 Sep 11  2014 mysqlshow
-rwxr-xr-x 1 root root     7367269 Sep 11  2014 mysqlslap
-rwxr-xr-x 1 root root     7957948 Sep 11  2014 mysqltest
-rwxr-xr-x 1 root root    72420298 Sep 11  2014 mysqltest_embedded
-rwxr-xr-x 1 root root     4384753 Sep 11  2014 mysql_tzinfo_to_sql
-rwxr-xr-x 1 root root     5928802 Sep 11  2014 mysql_upgrade
-rwxr-xr-x 1 root root     5725249 Sep 11  2014 mysql_waitpid
-rwxr-xr-x 1 root root        3356 Sep 11  2014 mysql_zap
[root@lunar mysql]# 

清理mysql的启动脚本:

[root@lunar mysql]# ll /etc/rc.d/init.d/mysql*
-rwxr-xr-x 1 root root 10815 Sep 11  2014 /etc/rc.d/init.d/mysql
[root@lunar mysql]# 

清理其他mysql的安装文件和目录:
[root@lunar mysql]# whereis mysql
mysql: /usr/bin/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
[root@lunar mysql]# 

再看一下系统中是否还有mysql的进程,如果有kill掉:

[root@lunar lib]# ps -ef|grep -i mysql
root      3733  3227  0 14:29 pts/0    00:00:00 mysql -h localhost -uroot -p
root      4706  3812  0 15:50 pts/4    00:00:00 grep -i mysql
[root@lunar lib]# ps -ef|grep 3733
root      3733  3227  0 14:29 pts/0    00:00:00 mysql -h localhost -uroot -p
root      4712  3812  0 15:50 pts/4    00:00:00 grep 3733
[root@lunar lib]# ps -ef|grep 3227
root      3227  2049  0 14:03 pts/0    00:00:00 -bash
root      3733  3227  0 14:29 pts/0    00:00:00 mysql -h localhost -uroot -p
root      4714  3812  0 15:50 pts/4    00:00:00 grep 3227
[root@lunar lib]# kill -9 3733
[root@lunar lib]# ps -ef|grep -i mysql
root      4716  3812  0 15:51 pts/4    00:00:00 grep -i mysql
[root@lunar lib]# 

我使用root的安装的,因此在/root下还有两个隐藏的mysql文件需要清理:
一个是记录了mysql的执行历史的文件:.mysql_history
一个是系统安装时生成的root的临时口令文件:.mysql_secret

他这两个文件直接删除就可以了,好了,现在系统就干净了。

还有一种简单的方法,直接查看系统当前所有的目录,然后对应的直接删除,在清理mysql进程就好了;
查看系统当前的各种目录:

mysql> show variables like '%dir%';
+-----------------------------------------+----------------------------+
| Variable_name                           | Value                      |
+-----------------------------------------+----------------------------+
| basedir                                 | /usr                       |
| binlog_direct_non_transactional_updates | OFF                        |
| character_sets_dir                      | /usr/share/mysql/charsets/ |
| datadir                                 | /var/lib/mysql/            |
| ignore_db_dirs                          |                            |
| innodb_data_home_dir                    |                            |
| innodb_log_group_home_dir               | ./                         |
| innodb_max_dirty_pages_pct              | 75                         |
| innodb_max_dirty_pages_pct_lwm          | 0                          |
| innodb_undo_directory                   | .                          |
| lc_messages_dir                         | /usr/share/mysql/          |
| plugin_dir                              | /usr/lib64/mysql/plugin/   |
| slave_load_tmpdir                       | /tmp                       |
| tmpdir                                  | /tmp                       |
+-----------------------------------------+----------------------------+
14 rows in set (0.00 sec)

mysql> 
发表在 FAQ | 标签为 , | 留下评论

MYSQL小白的FAQ系列—-3—-创建用户,授权等

授权命令GRANT 语句的语法如下:

GRANT privileges (columns) 
ON what 
TO user IDENTIFIEDBY "password" 
WITH GRANT OPTION 

例1: 创建一个lunardb,并创建用户lunar从本机访问lunardb:

mysql> create database lunardb;
Query OK, 1 row affected (0.05 sec)

mysql> grant all privileges on lunardb.* to lunar@localhost identified by "lunar";
Query OK, 0 rows affected (0.06 sec)

mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

mysql> exit
Bye
[root@lunar mysql5.6]#

使用lunar用户访问lunardb:

[root@lunar mysql5.6]# mysql -ulunar -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.21-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select database();
+------------+
| database() |
+------------+
| NULL       |
+------------+
1 row in set (0.00 sec)

mysql> use lunardb;
Database changed
mysql> show database();
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database()' at line 1
mysql> select database();
+------------+
| database() |
+------------+
| lunardb    |
+------------+
1 row in set (0.00 sec)

mysql> select user();
+-----------------+
| user()          |
+-----------------+
| lunar@localhost |
+-----------------+
1 row in set (0.00 sec)

mysql> 

例2: 授予lunar从本机访问lunardb,从192.168.56.66访问test数据库,从所有主机访问mysql数据库:
grant select,insert,update,delete,create,drop on lunardb.* to lunar@localhost identified by “lunar”;
grant select,insert,update,delete,create,drop on test.* to lunar@192.168.56.66 identified by “lunar”;
grant select,insert,update,delete,create,drop on mysql.* to lunar@’%’ identified by “lunar”;

查看所有用户以及他们的权限:

mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+--------------------------------+
| query                          |
+--------------------------------+
| User: 'lunar'@'%';             |
| User: 'root'@'127.0.0.1';      |
| User: 'lunar'@'192.168.56.66'; |
| User: 'root'@'::1';            |
| User: 'lunar'@'localhost';     |
| User: 'root'@'localhost';      |
| User: 'root'@'lunar';          |
+--------------------------------+
7 rows in set (0.07 sec)

mysql> 

–查看lunar和root的用户的授权信息:

mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

mysql> show grants for 'lunar'@'%';
+------------------------------------------------------------------------------------------------------+
| Grants for lunar@%                                                                                   |
+------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'lunar'@'%' IDENTIFIED BY PASSWORD '*26C772B5D40BC7BC8FDD90CDC5C1100110433463' |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON `mysql`.* TO 'lunar'@'%'                       |
+------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> show grants for 'root'@'%';
ERROR 1141 (42000): There is no such grant defined for user 'root' on host '%'
mysql> show grants;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*8D4165021FB50C23292ACA2C4478CB9688E08607' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION                                                                           |
+----------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> 

上面的错误表示root用户没有’%’的授权,’%’表示说有主机(从所有主机连接,比如远程登录过来),因此,我来授权一下:

mysql> grant all privileges on *.* to 'root'@'%' with grant option;  
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> show grants for 'root'@'%';
+-------------------------------------------------------------+
| Grants for root@%                                           |
+-------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION |
+-------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show grants;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*8D4165021FB50C23292ACA2C4478CB9688E08607' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION                                                                           |
+----------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> 

mysql的用户权限等信息都记录在mysql.user中,查看user表的定义:

mysql> desc mysql.user;
+------------------------+-----------------------------------+------+-----+---------+-------+
| Field                  | Type                              | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+---------+-------+
| Host                   | char(60)                          | NO   | PRI |         |       |
| User                   | char(16)                          | NO   | PRI |         |       |
| Password               | char(41)                          | NO   |     |         |       |
| Select_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Insert_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Update_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Delete_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Create_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Drop_priv              | enum('N','Y')                     | NO   |     | N       |       |
| Reload_priv            | enum('N','Y')                     | NO   |     | N       |       |
| Shutdown_priv          | enum('N','Y')                     | NO   |     | N       |       |
| Process_priv           | enum('N','Y')                     | NO   |     | N       |       |
| File_priv              | enum('N','Y')                     | NO   |     | N       |       |
| Grant_priv             | enum('N','Y')                     | NO   |     | N       |       |
| References_priv        | enum('N','Y')                     | NO   |     | N       |       |
| Index_priv             | enum('N','Y')                     | NO   |     | N       |       |
| Alter_priv             | enum('N','Y')                     | NO   |     | N       |       |
| Show_db_priv           | enum('N','Y')                     | NO   |     | N       |       |
| Super_priv             | enum('N','Y')                     | NO   |     | N       |       |
| Create_tmp_table_priv  | enum('N','Y')                     | NO   |     | N       |       |
| Lock_tables_priv       | enum('N','Y')                     | NO   |     | N       |       |
| Execute_priv           | enum('N','Y')                     | NO   |     | N       |       |
| Repl_slave_priv        | enum('N','Y')                     | NO   |     | N       |       |
| Repl_client_priv       | enum('N','Y')                     | NO   |     | N       |       |
| Create_view_priv       | enum('N','Y')                     | NO   |     | N       |       |
| Show_view_priv         | enum('N','Y')                     | NO   |     | N       |       |
| Create_routine_priv    | enum('N','Y')                     | NO   |     | N       |       |
| Alter_routine_priv     | enum('N','Y')                     | NO   |     | N       |       |
| Create_user_priv       | enum('N','Y')                     | NO   |     | N       |       |
| Event_priv             | enum('N','Y')                     | NO   |     | N       |       |
| Trigger_priv           | enum('N','Y')                     | NO   |     | N       |       |
| Create_tablespace_priv | enum('N','Y')                     | NO   |     | N       |       |
| ssl_type               | enum('','ANY','X509','SPECIFIED') | NO   |     |         |       |
| ssl_cipher             | blob                              | NO   |     | NULL    |       |
| x509_issuer            | blob                              | NO   |     | NULL    |       |
| x509_subject           | blob                              | NO   |     | NULL    |       |
| max_questions          | int(11) unsigned                  | NO   |     | 0       |       |
| max_updates            | int(11) unsigned                  | NO   |     | 0       |       |
| max_connections        | int(11) unsigned                  | NO   |     | 0       |       |
| max_user_connections   | int(11) unsigned                  | NO   |     | 0       |       |
| plugin                 | char(64)                          | YES  |     |         |       |
| authentication_string  | text                              | YES  |     | NULL    |       |
| password_expired       | enum('N','Y')                     | NO   |     | N       |       |
+------------------------+-----------------------------------+------+-----+---------+-------+
43 rows in set (0.05 sec)

mysql>
发表在 FAQ | 标签为 , , | 留下评论

MYSQL小白的FAQ系列—-2—-几种常见情况下需要修改mysql的root口令的处理

一般常见的,两种情况下必须修改mysql的root口令。
一种是刚安装完,系统提示:ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
修改方法就如提示所说,使用set password命令,例如:set password=password(“lunar”);

[root@lunar mysql5.6]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.21-enterprise-commercial-advanced

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> set password=password("lunar");
Query OK, 0 rows affected (0.19 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.05 sec)

mysql> 

另一种是,忘记了mysql的root口令,需要启动到单用户模式来修改:
停止mysql服务:

[root@lunar ~]# /etc/init.d/mysql stop
Shutting down MySQL....[  OK  ]
或者 
Bye
[root@lunar mysql5.6]# service mysql stop
Shutting down MySQL..[  OK  ]
[root@lunar mysql5.6]#

安全模式启动mysql:

[root@lunar ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 4153
[root@lunar ~]# 140803 15:12:22 mysqld_safe Logging to '/var/lib/mysql/lunar.err'.
140803 15:12:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

这里 --skip-grant-tables会跳过mysql的授权
mysql的启动日志记录在/var/lib/mysql/lunar.err

也可以简单的使用:mysqld_safe --skip-grant-tables &
[root@lunar mysql5.6]# mysqld_safe --skip-grant-tables &
[1] 5200
[root@lunar mysql5.6]# 140803 16:24:16 mysqld_safe Logging to '/var/lib/mysql/lunar.err'.
140803 16:24:16 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[root@lunar mysql5.6]#

然后,进入mysql数据库:

[root@lunar ~]# mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.21-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> 

或者简单的使用:mysql -p
[root@lunar mysql5.6]# mysql -p
Enter password:   --注意,这里不用输入任何口令,直接回车就可以了
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.21-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

现在,可以使用update修改root口令为:lunarbaobao

mysql> UPDATE user SET Password=PASSWORD('lunarbaobao') where USER='root' and host='root' or host='localhost';
Query OK, 1 row affected (0.09 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.05 sec)

mysql> exit
Bye

如果要修改所有数据库的root口令,那么只需要where user='root'就可以了,不用指定host,即:
mysql> update mysql.user set password=password("lunarbaobao") where user='root';
Query OK, 4 rows affected (0.05 sec)
Rows matched: 4  Changed: 4  Warnings: 0

mysql> select * from mysql.user;
+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+
| Host      | User | Password                                  | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string | password_expired |
+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+
| localhost | root | *8D4165021FB50C23292ACA2C4478CB9688E08607 | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 |        |                       | N                |
| lunar     | root | *8D4165021FB50C23292ACA2C4478CB9688E08607 | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 |        |                       | Y                |
| 127.0.0.1 | root | *8D4165021FB50C23292ACA2C4478CB9688E08607 | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 |        |                       | Y                |
| ::1       | root | *8D4165021FB50C23292ACA2C4478CB9688E08607 | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 |        |                       | Y                |
+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+
4 rows in set (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.07 sec)

mysql> 

mysql缺省的本地主机是localhost,对应的IP是127.0.0.1。
可以看到,当前的mysql认到的4个主机标识都修改了。

接下来,重启mysql服务:

[root@lunar ~]# /etc/init.d/mysql restart
Shutting down MySQL..140803 15:13:35 mysqld_safe mysqld from pid file /var/lib/mysql/lunar.pid ended
[  OK  ]
Starting MySQL.[  OK  ]
[1]+  Done                    mysqld_safe --user=mysql --skip-grant-tables --skip-networking
[root@lunar ~]# 
或者
[root@lunar mysql5.6]# service mysql stop
Shutting down MySQL..140803 16:33:00 mysqld_safe mysqld from pid file /var/lib/mysql/lunar.pid ended
[  OK  ]
[1]+  Done                    mysqld_safe --skip-grant-tables
[root@lunar mysql5.6]# service mysql start
Starting MySQL.[  OK  ]
[root@lunar mysql5.6]# 

也可以尝试kill 所有mysql的进程:
ps -ef |grep mysql|xargs kill -9

再次登录试试看:
[root@lunar mysql5.6]# mysql -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.21-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

mysql> 

平时如果需要,也可以使用update user命令来修改用户口令,例如:
update user set password=password(“lunar”) where user=’root’;
flush privileges;

发表在 FAQ | 标签为 , | 留下评论

MYSQL小白的FAQ系列—-1—-使用rpm包后的常见问题

###########################################################################
问题1:使用rpm包安装后,登录mysql报错 ERROR 2002 (HY000):
###########################################################################

[root@lunar ~]# mysql -h localhost -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@lunar ~]#

解决:
检查安装记录,里面记录着:

2014-08-03 15:53:45 4780 [Note] InnoDB: FTS optimize thread exiting.
2014-08-03 15:53:45 4780 [Note] InnoDB: Starting shutdown...
2014-08-03 15:53:47 4780 [Note] InnoDB: Shutdown completed; log sequence number 1625987

因此,知道了,安装完成后,服务是关闭的,于是启动服务就好了,O(∩_∩)O哈哈~:

[root@lunar mysql]# service mysql status
MySQL is not running[FAILED]
[root@lunar mysql]# service mysql start
Starting MySQL...........................[  OK  ]
[root@lunar mysql]# service mysql status
MySQL running (3636)[  OK  ]
[root@lunar mysql]# mysql -h localhost -uroot 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

这里看到,之前的 ERROR 2002 (HY000)不见了,多出来新的报错:
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)

###########################################################################
问题2:上面的ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
###########################################################################

这个问题,主要是mysql 5.6在linux下使用rpm包安装后,会自动生成一个root的口令(之前的版本是空口令),这一信息在安装时有显示:

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

也就是说,安装后,建议使用SET PASSWORD修改口令,并使用/usr/bin/mysql_secure_installation删除test数据库。
这是强烈推荐的步骤。
于是首先使用它自动生成的口令登陆试试看:

[root@lunar ~]# cat /root/.mysql_secret
# The random password set for the root user at Sun Aug  3 13:53:17 2014 (local time): SThC8zYvMFuPjqdM

[root@lunar ~]# 
[root@lunar mysql]# mysql -h localhost -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.21-enterprise-commercial-advanced

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

可以了。
当然,这里我没有尝试,直接启动到安全模式,然后修改root口令,感觉应该也可以的。

发表在 FAQ | 标签为 , , | 留下评论

Windows上Mysql 5.6 免安装版的mysql配置

以前从没玩过mysql,这两天忽然心血来潮,感觉好玩,看了一点点文档,决定玩玩mysql,O(∩_∩)O哈哈~

今天在火车上,闲得无聊,找了一个windows版本的mysql,尝试免安装版的手动配置mysql。

大致思路:

1,手工编辑my.ini(linux上是my.cnf)
2,注册到windows服务
3,修改系统环境变量
4,测试

mysql5.1版本,如果用免安装版本的话,解压后,缺省会有一些配置文件模板,
昨天下载了一个5.6的免安装版本,发现里面只有一个my-default.ini,内容类似:
下面的内容是我稍微修改的:

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[client]
port=3306

[WindowsMysql5.6]
Server="d:/mysql5.6/bin/mysqld.ext"

[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
log_bin="d:/mysql5.6/binlog/"

# These are commonly set, remove the # and set as required.
basedir = "d:/mysql5.6/"
datadir = "d:/mysql5.6/data/"
port = 3306
server_id = 1


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

这里面看到windows下面的目录文件号居然也要用“/”,确实奇葩。
开始我用的“\”,注册服务后,启动mysql时就报错了:

D:\mysql5.6\bin>net start mysql
MySQL 服务正在启动 ...
MySQL 服务无法启动。

系统出错。

发生系统错误 1067。

进程意外终止。

修改成“/”后,问题解决了:

D:\mysql5.6\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

如果使用exe的方式安装mysql,会自动配置好环境变量。
如果用免安装的方式,那么需要手工配置环境变量:

D:\ORACLE\product\12.1.0\dbhome_1\bin;C:\Program Files (x86)\Common Files\NetSarang;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Lenovo\Fingerprint Manager Pro\;d:\mysql5.6\bin

测试一下,ok了,O(∩_∩)O哈哈~:

C:\Users\Lunar>mysql -h localhost -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.21-log MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version(), current_date();
+------------+----------------+
| version()  | current_date() |
+------------+----------------+
| 5.6.21-log | 2014-11-02     |
+------------+----------------+
1 row in set (0.04 sec)

mysql>
发表在 安装配置 | 留下评论

EBS克隆–db和app分开在两个服务器上

本次的环境:
源:DB和APP在同一台机器上,数据库 11.2.0.4,EBS 12.2
目标: DB和APP在不同服务器上,数据库 11.2.0.4,EBS 12.2

EBS 12.2有一个新特性,online patch的功能,因此,app上会有两个应用目录,比如fs1和fs2,其中fs1为run instance,而fs2为patch instance,这样patch的时候,他可以先patch fs2,然后fs2切换为run instance,而fs1再切换为patch instance来apply patch。
具体操作大致步骤如下:
 克隆时,先克隆db,再克隆app
 磁盘空间要求:Oracle Fusion Middleware cloning tools require 6GB in /tmp and 6GB under $COMMON_TOP.
 在做prepare clone的过程中,source系统的数据库必须是处于running状态
 prepare clone过程中,source系统的应用可以处于running状态
 每次source系统的更新都应该重新执行prepare clone操作,如增加datafile、apply patch
 如果source系统未及时更新prepare clone,而已经把文件copy到了target系统,则可以在source系统中执行prepare clone操作,然后将prepare clone操作所更新的文件覆盖至target系统。

prepare clone操作更新文件目录如下(也就是在源系统上先执行prepare clone,然后把下面的分拣分别用db用户和app用户copy到对应的目标系统上):
dbtier:$ORACLE_HOME/appsutil/clone
apptier:$COMMON_TOP/clone

标准克隆(standard cloning)的过程主要是2个:
standard cloning process for Application Tier basically involves the following two key processes:
1. 从源环境的run fs拷贝到目标系统的run fs:(Copy Application Tier node from the Source “Run Edition File System” to the Target “Run Edition File System”).(即,从源系统上克隆fs1到目标系统的fs1,源系统的fs1就是其run fs,目标系统的fs1也是其run fs)
2. 从目标系统的run fs拷贝到目标系统的patch fs:(Copy the Application Tier node from the Target “Run Edition File System” to the Target “Patch Edition File System”).(即,使用目标上已经克隆好的fs1,进行克隆,克隆到目标系统的fs2。目标系统的fs1为run fs,fs2为patch fs)

然后,执行db的clone:

[oracrp3@ebscrp3 CRP3_ebscrp3]$ perl adpreclone.pl dbTier

                     Copyright (c) 2011, 2014 Oracle Corporation
                        Redwood Shores, California, USA

                        Oracle E-Business Suite Rapid Clone

                                 Version 12.2

                      adpreclone Version 120.31.12020000.16

Enter the APPS User Password:     ------这里输入口令 apps
Running:
perl /u01/crp3/db/11.2.0/appsutil/bin/adclone.pl java=/u01/crp3/db/11.2.0/appsutil/jre mode=stage stage=/u01/crp3/db/11.2.0/appsutil/clone component=dbTier method=CUSTOM dbctx=/u01/crp3/db/11.2.0/appsutil/CRP3_ebscrp3.xml showProgress 


Beginning database tier Stage - Fri Oct 17 19:26:48 2014
-------开始执行预克隆的时间
/u01/crp3/db/11.2.0/appsutil/jre/bin/java -Xmx600M -DCONTEXT_VALIDATED=false -Doracle.installer.oui_loc=/u01/crp3/db/11.2.0/oui -classpath /u01/crp3/db/11.2.0/lib/xmlparserv2.jar:/u01/crp3/db/11.2.0/jdbc/lib/ojdbc6.jar:/u01/crp3/db/11.2.0/appsutil/java:/u01/crp3/db/11.2.0/oui/jlib/OraInstaller.jar:/u01/crp3/db/11.2.0/oui/jlib/ewt3.jar:/u01/crp3/db/11.2.0/oui/jlib/share.jar:/u01/crp3/db/11.2.0/oui/jlib/srvm.jar:/u01/crp3/db/11.2.0/jlib/ojmisc.jar   oracle.apps.ad.clone.StageDBTier -e /u01/crp3/db/11.2.0/appsutil/CRP3_ebscrp3.xml -stage /u01/crp3/db/11.2.0/appsutil/clone -tmp /tmp -method CUSTOM    -showProgress
APPS Password : 
Log file located at /u01/crp3/db/11.2.0/appsutil/log/CRP3_ebscrp3/StageDBTier_10171926.log

  -     50% completed       

Completed Stage...
Fri Oct 17 19:27:24 2014    -----完成预克隆的时间
[oracrp3@ebscrp3 CRP3_ebscrp3]$       

接下来在,app的fs1(run instance)上使用adpreclone.pl执行fs1的预克隆:

[applcrp3@ebscrp3 scripts]$ perl adpreclone.pl appsTier

                     Copyright (c) 2011, 2014 Oracle Corporation
                        Redwood Shores, California, USA

                        Oracle E-Business Suite Rapid Clone

                                 Version 12.2

                      adpreclone Version 120.31.12020000.16

Enter the APPS User Password:       ---输入口令 apps
Enter the Weblogic AdminServer password :   ---输入口令 manager0

 Checking the status of the Oracle WebLogic Administration Server....

 Running perl /u01/crp3/app/fs1/EBSapps/appl/ad/12.0.0/patch/115/bin/adProvisionEBS.pl ebs-get-serverstatus -contextfile=/u01/crp3/app/fs1/inst/apps/CRP3_ebscrp3/appl/admin/CRP3_ebscrp3.xml -servername=AdminServer -promptmsg=hide  

The Oracle WebLogic Administration Server is up.

Running:
perl /u01/crp3/app/fs1/EBSapps/appl/ad/12.0.0/bin/adclone.pl java=/u01/crp3/app/fs1/EBSapps/comn/util/jdk64 mode=stage stage=/u01/crp3/app/fs1/EBSapps/comn/clone component=appsTier method= appctx=/u01/crp3/app/fs1/inst/apps/CRP3_ebscrp3/appl/admin/CRP3_ebscrp3.xml showProgress 



 Setting the wls environment 

Beginning application tier Stage - Fri Oct 17 19:57:05 2014
----开始执行克隆的时间

/u01/crp3/app/fs1/EBSapps/comn/util/jdk64/bin/java -Xmx600M -DCONTEXT_VALIDATED=false -Doracle.installer.oui_loc=/oui -classpath /u01/crp3/app/fs1/FMW_Home/webtier/lib/xmlparserv2.jar:/u01/crp3/app/fs1/FMW_Home/webtier/jdbc/lib/ojdbc6.jar:/u01/crp3/app/fs1/EBSapps/comn/java/classes:/u01/crp3/app/fs1/FMW_Home/webtier/oui/jlib/OraInstaller.jar:/u01/crp3/app/fs1/FMW_Home/webtier/oui/jlib/ewt3.jar:/u01/crp3/app/fs1/FMW_Home/webtier/oui/jlib/share.jar:/u01/crp3/app/fs1/FMW_Home/webtier/../Oracle_EBS-app1/oui/jlib/srvm.jar:/u01/crp3/app/fs1/FMW_Home/webtier/jlib/ojmisc.jar:/u01/crp3/app/fs1/FMW_Home/wlserver_10.3/server/lib/weblogic.jar:/u01/crp3/app/fs1/FMW_Home/oracle_common/jlib/obfuscatepassword.jar  oracle.apps.ad.clone.StageAppsTier -e /u01/crp3/app/fs1/inst/apps/CRP3_ebscrp3/appl/admin/CRP3_ebscrp3.xml -stage /u01/crp3/app/fs1/EBSapps/comn/clone -tmp /tmp -method CUSTOM   -showProgress -nopromptmsg 

Log file located at /u01/crp3/app/fs1/inst/apps/CRP3_ebscrp3/admin/log/clone/StageAppsTier_10171957.log


3.2.1.5	回到lunar-app的会话
假设中途这个操作中断了,不要紧,因为我们是在screen中执行的,只需要输入 screen -r lunar-app,就回到了那个中断的会话:
[root@ebscrp3 ~]# screen -ls
There is a screen on:
        15219.lunar-app (Detached)
1 Socket in /var/run/screen/S-root.

[root@ebscrp3 ~]# screen -r lunar-app
Enter the APPS User Password:
Enter the Weblogic AdminServer password :

 Checking the status of the Oracle WebLogic Administration Server....

 Running perl /u01/crp3/app/fs1/EBSapps/appl/ad/12.0.0/patch/115/bin/adProvisionEBS.pl ebs-get-serverstatus -contextfile=/u01/crp3/app/fs1/inst/apps/CRP3_ebscrp3/appl/admin/CRP3_ebscrp3.xml -servername=AdminServer -promptmsg=hide

The Oracle WebLogic Administration Server is up.

Running:
perl /u01/crp3/app/fs1/EBSapps/appl/ad/12.0.0/bin/adclone.pl java=/u01/crp3/app/fs1/EBSapps/comn/util/jdk64 mode=stage stage=/u01/crp3/app/fs1/EBSapps/comn/clone component=appsTier method= appctx=/u01/crp3/app/fs1/inst/apps/CRP3_ebscrp3/appl/admin/CRP3_ebscrp3.xml showProgress



 Setting the wls environment

Beginning application tier Stage - Fri Oct 17 19:57:05 2014
----开始执行克隆的时间

/u01/crp3/app/fs1/EBSapps/comn/util/jdk64/bin/java -Xmx600M -DCONTEXT_VALIDATED=false -Doracle.installer.oui_loc=/oui -classpath /u01/crp3/app/fs1/FMW_Home/webtier/lib/xmlparserv2.jar:/u01/crp3/app/fs1/FMW_Home/webtier/jdbc/lib/ojdbc6.jar:/u01/crp3/app/fs1/EBSapps/comn/java/classes:/u01/crp3/app/fs1/FMW_Home/webtier/oui/jlib/OraInstaller.jar:/u01/crp3/app/fs1/FMW_Home/webtier/oui/jlib/ewt3.jar:/u01/crp3/app/fs1/FMW_Home/webtier/oui/jlib/share.jar:/u01/crp3/app/fs1/FMW_Home/webtier/../Oracle_EBS-app1/oui/jlib/srvm.jar:/u01/crp3/app/fs1/FMW_Home/webtier/jlib/ojmisc.jar:/u01/crp3/app/fs1/FMW_Home/wlserver_10.3/server/lib/weblogic.jar:/u01/crp3/app/fs1/FMW_Home/oracle_common/jlib/obfuscatepassword.jar  oracle.apps.ad.clone.StageAppsTier -e /u01/crp3/app/fs1/inst/apps/CRP3_ebscrp3/appl/admin/CRP3_ebscrp3.xml -stage /u01/crp3/app/fs1/EBSapps/comn/clone -tmp /tmp -method CUSTOM   -showProgress -nopromptmsg

Log file located at /u01/crp3/app/fs1/inst/apps/CRP3_ebscrp3/admin/log/clone/StageAppsTier_10171957.log

  \     20% completed

Completed Stage...
Fri Oct 17 20:11:44 2014   ----完成app预克隆的时间
[applcrp3@ebscrp3 scripts]$      

接下来,要把相应的文件分别拷贝到目标的db服务器和相应的app服务器上。
在文件copy的过程中,source系统的ebs 数据库跟应用都必须处于停止状态,否则很容易造成数据文件的不一致而导致clone失败。

执行tar命令:
 [root@ebscrp3 db]#
[oracrp3@ebscrp3 crp3]$ tar -czvf db_20141017.tar.gz db/

该目录中的内容如下:
[root@ebscrp3 db]# pwd
/u01/crp3/db
[root@ebscrp3 db]# ll
total 8
drwxr-xr-x 85 oracrp3 dba 4096 Oct 15 22:50 11.2.0    -----oracle二进制文件
drwxr-xr-x  3 oracrp3 dba 4096 Oct 16 14:30 data      ------oracle db的datafile

[applcrp3@ebscrp3 fs1]$ tar -czvf EBSapps_20141017.tar.gz  EBSapps/

在目标服务器上执行预安装,即准备环境,具体请参考《EBS克隆–从已有的tar包克隆一套EBS(db和app在同一台机器上)
执行clone之前,比如先reboot主机,否则会报错
下面是clone的过程,同《EBS克隆–从已有的tar包克隆一套EBS(db和app在同一台机器上)》类似:

[orastu@ebsdba1 bin]$ perl adcfgclone.pl dbTier

                     Copyright (c) 2011 Oracle Corporation
                        Redwood Shores, California, USA

                        Oracle E-Business Suite Rapid Clone

                                 Version 12.2

                      adcfgclone Version 120.63.12020000.35

Enter the APPS password :  口令apps

Running:
/u01/stu/db/11.2.0/appsutil/clone/bin/../jre/bin/java -Xmx600M -cp /u01/stu/db/11.2.0/appsutil/clone/jlib/java:/u01/stu/db/11.2.0/appsutil/clone/jlib/xmlparserv2.jar:/u01/stu/db/11.2.0/appsutil/clone/jlib/ojdbc5.jar:/u01/stu/db/11.2.0/appsutil/clone/jlib/obfuscatepassword.jar:/u01/stu/db/11.2.0/appsutil/clone/jlib/ojmisc.jar:/u01/stu/db/11.2.0/appsutil/clone/jlib/java:/u01/stu/db/11.2.0/appsutil/clone/jlib/emCfg.jar oracle.apps.ad.context.CloneContext -e /u01/stu/db/11.2.0/appsutil/clone/bin/../context/db/CTXORIG.xml -validate -pairsfile /tmp/adpairsfile_5959.lst -stage /u01/stu/db/11.2.0/appsutil/clone  2> /tmp/adcfgclone_5959.err; echo $? > /tmp/adcfgclone_5959.res

Log file located at /u01/stu/db/11.2.0/appsutil/clone/bin/CloneContext_1021134628.log

Provide the values required for creation of the new Database Context file.

Target System Hostname (virtual or normal) [ebsdba1] : 

Target Instance is RAC (y/n) [n] : 

Target System Database SID : STU    一般SID都填写大写

Target System Base Directory : /u01/stu/db         

Target System utl_file_dir Directory List : /u01/stu/temp

Number of DATA_TOP's on the Target System [1] : 

Target System DATA_TOP Directory 1 [/u01/crp3/db/data] : /u01/stu/db/data

Target System RDBMS ORACLE_HOME Directory [/u01/stu/db/11.2.0] : 

Do you want to preserve the Display [ebscrp3:0.0] (y/n)  : Y

Do you want the target system to have the same port values as the source system (y/n) [y] ? : n

Target System Port Pool [0-99] : 6

Checking the port pool 6
done: Port Pool 6 is free
Report file located at /u01/stu/db/11.2.0/appsutil/temp/portpool.lst
Complete port information available at /u01/stu/db/11.2.0/appsutil/temp/portpool.lst

Creating the new Database Context file from :
  /u01/stu/db/11.2.0/appsutil/clone/context/db/adxdbctx.tmp

The new database context file has been created :
  /u01/stu/db/11.2.0/appsutil/STU_ebsdba1.xml

Log file located at /u01/stu/db/11.2.0/appsutil/clone/bin/CloneContext_1021134628.log
Check Clone Context logfile /u01/stu/db/11.2.0/appsutil/clone/bin/CloneContext_1021134628.log for details.

Running Rapid Clone with command:
Running:
perl /u01/stu/db/11.2.0/appsutil/clone/bin/adclone.pl java=/u01/stu/db/11.2.0/appsutil/clone/bin/../jre mode=apply stage=/u01/stu/db/11.2.0/appsutil/clone component=dbTier method=CUSTOM dbctxtg=/u01/stu/db/11.2.0/appsutil/STU_ebsdba1.xml showProgress contextValidated=true


Beginning database tier Apply - Tue Oct 21 13:47:44 2014

/u01/stu/db/11.2.0/appsutil/clone/bin/../jre/bin/java -Xmx600M -DCONTEXT_VALIDATED=true -Doracle.installer.oui_loc=/u01/stu/db/11.2.0/oui -classpath /u01/stu/db/11.2.0/appsutil/clone/jlib/xmlparserv2.jar:/u01/stu/db/11.2.0/appsutil/clone/jlib/ojdbc6.jar:/u01/stu/db/11.2.0/appsutil/clone/jlib/java:/u01/stu/db/11.2.0/appsutil/clone/jlib/oui/OraInstaller.jar:/u01/stu/db/11.2.0/appsutil/clone/jlib/oui/ewt3.jar:/u01/stu/db/11.2.0/appsutil/clone/jlib/oui/share.jar:/u01/stu/db/11.2.0/appsutil/clone/jlib/oui/srvm.jar:/u01/stu/db/11.2.0/appsutil/clone/jlib/ojmisc.jar   oracle.apps.ad.clone.ApplyDBTier -e /u01/stu/db/11.2.0/appsutil/STU_ebsdba1.xml -stage /u01/stu/db/11.2.0/appsutil/clone   -showProgress
APPS Password : Log file located at /u01/stu/db/11.2.0/appsutil/log/STU_ebsdba1/ApplyDBTier_10211347.log
  |      0% completed       Determining Source system database type ("single" or "rac").
Source system indentified as being of type "single"!
  /     15% completed       

Completed Apply...
Tue Oct 21 13:54:41 2014

Starting database listener for STU:
Running:
/u01/stu/db/11.2.0/appsutil/scripts/STU_ebsdba1/addlnctl.sh start STU
Logfile: /u01/stu/db/11.2.0/appsutil/log/STU_ebsdba1/addlnctl.txt

You are running addlnctl.sh version 120.4


Starting listener process STU ...


Listener STU has already been started.


addlnctl.sh: exiting with status 0

addlnctl.sh: check the logfile /u01/stu/db/11.2.0/appsutil/log/STU_ebsdba1/addlnctl.txt for more information ...  


Do you want to change the password for all EBS Schemas? (y/n) [n]) : 

Do you want to change the apps password? (y/n) [n]) : 

Do you want to change the sys and system passwords? (y/n) [n]) : 
[orastu@ebsdba1 bin]$

之后,修改环境变量,并创建db的启停脚本

启动脚本:
[orastu@ebsdba1 ~]$ cat startDB.sh 
$ORACLE_HOME/appsutil/scripts/STU_ebsSTU/addlnctl.sh start STU
$ORACLE_HOME/appsutil/scripts/STU_ebsSTU/addbctl.sh start

停止脚本:
[orastu@ebsdba1 ~]$ 
[orastu@ebsdba1 ~]$ cat stopDB.sh 
$ORACLE_HOME/appsutil/scripts/STU_ebsdba1/addbctl.sh stop immediate
$ORACLE_HOME/appsutil/scripts/STU_ebsdba1/addlnctl.sh stop STU

[orastu@ebsdba1 ~]$

在目标app服务器上执行app的run fs(FS1)的adcfgclone:

[applstu@ebsdba2 bin]$ perl adcfgclone.pl appsTier

                     Copyright (c) 2011 Oracle Corporation
                        Redwood Shores, California, USA

                        Oracle E-Business Suite Rapid Clone

                                 Version 12.2

                      adcfgclone Version 120.63.12020000.35

Enter the APPS password :  口令是apps
Running:
/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre/bin/java -Xmx600M -classpath /u01/stu/app/fs1/EBSapps/comn/clone/jlib/obfuscatepassword.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojmisc.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/emCfg.jar oracle.apps.ad.clone.util.OPWrapper -encryptpwd /u01/stu/app/fs1/EBSapps/comn/clone/bin/../FMW/tempinfoApps.txt

Enter the Weblogic AdminServer password :  口令是manager0
Running:
/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre/bin/java -Xmx600M -classpath /u01/stu/app/fs1/EBSapps/comn/clone/jlib/obfuscatepassword.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojmisc.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/emCfg.jar oracle.apps.ad.clone.util.OPWrapper /u01/stu/app/fs1/EBSapps/comn/clone/bin/../FMW/tempinfo.txt
Running:
/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre/bin/java -Xmx600M -classpath /u01/stu/app/fs1/EBSapps/comn/clone/jlib/obfuscatepassword.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojmisc.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/emCfg.jar oracle.apps.ad.clone.util.OPWrapper /u01/stu/app/fs1/EBSapps/comn/clone/bin/../FMW/EBSDataSource


Do you want to add a node (yes/no) [no] : 


Running:
/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre/bin/java -Xmx600M -cp /u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/xmlparserv2.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojdbc5.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/obfuscatepassword.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojmisc.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/emCfg.jar oracle.apps.ad.context.CloneContext -e /u01/stu/app/fs1/EBSapps/comn/clone/bin/../context/apps/CTXORIG.xml -validate -pairsfile /tmp/adpairsfile_11407.lst -stage /u01/stu/app/fs1/EBSapps/comn/clone  2> /tmp/adcfgclone_11407.err; echo $? > /tmp/adcfgclone_11407.res

Log file located at /u01/stu/app/fs1/EBSapps/comn/clone/bin/CloneContext_1022140108.log

Target System File Edition type [run] : 

Provide the values required for creation of the new APPL_TOP Context file.

Target System Hostname (virtual or normal) [ebsdba2] : 

Target System Database SID : STU

Target System Database Server Node [ebsdba2] : ebsdba1

Target System Database Domain Name [800best.com] : 

Target System Base Directory : /u01/stu/app

Target System Base Directory set to /u01/stu/app

--以下是自动创建的目录:
Target System Current File System Base set to /u01/stu/app/fs1

Target System Other File System Base set to /u01/stu/app/fs2

Target System Fusion Middleware Home set to /u01/stu/app/fs1/FMW_Home

Target System Web Oracle Home set to /u01/stu/app/fs1/FMW_Home/webtier

Target System Appl TOP set to /u01/stu/app/fs1/EBSapps/appl

Target System COMMON TOP set to /u01/stu/app/fs1/EBSapps/comn

Target System Instance Home Directory [/u01/stu/app] : 

Target System Instance Top set to /u01/stu/app/fs1/inst/apps/STU_ebsdba2

Do you want to preserve the Display [ebscrp3:0.0] (y/n)  : y

Target System Root Service [enabled] : 

Target System Web Administration [enabled] : 

Target System Web Entry Point Services [enabled] : 

Target System Web Application Services [enabled] : 

Target System Batch Processing Services [enabled] : 

Target System Other Services [disabled] : 

Do you want the target system to have the same port values as the source system (y/n) [y] ? : n

Target System Port Pool [0-99] : 6

Checking the port pool 6
done: Port Pool 6 is free
Report file located at /u01/stu/app/fs1/inst/apps/STU_ebsdba2/admin/out/portpool.lst
Complete port information available at /u01/stu/app/fs1/inst/apps/STU_ebsdba2/admin/out/portpool.lst

UTL_FILE_DIR on database tier consists of the following directories.

1. /usr/tmp
2. /u01/stu/temp
3. /u01/stu/db/11.2.0/appsutil/outbound/STU_ebsdba1
4. /usr/tmp
Choose a value which will be set as APPLPTMP value on the target node [1] : 2

Creating the new APPL_TOP Context file from :
  /u01/stu/app/fs1/EBSapps/comn/clone/context/apps/adxmlctx.tmp

The new APPL_TOP context file has been created :
  /u01/stu/app/fs1/inst/apps/STU_ebsdba2/appl/admin/STU_ebsdba2.xml

Log file located at /u01/stu/app/fs1/EBSapps/comn/clone/bin/CloneContext_1022140242.log
Check Clone Context logfile /u01/stu/app/fs1/EBSapps/comn/clone/bin/CloneContext_1022140242.log for details.

Running Rapid Clone with command:
Running:
perl /u01/stu/app/fs1/EBSapps/comn/clone/bin/adclone.pl java=/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre mode=apply stage=/u01/stu/app/fs1/EBSapps/comn/clone component=appsTier method=CUSTOM appctxtg=/u01/stu/app/fs1/inst/apps/STU_ebsdba2/appl/admin/STU_ebsdba2.xml showProgress contextValidated=true



FMW Pre-requisite check log file location : /u01/stu/app/fs1/EBSapps/comn/clone/FMW/logs/prereqcheck.log

Running: /u01/stu/app/fs1/EBSapps/comn/clone/FMW/t2pjdk/bin/java -classpath /u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/Scripts/ext/jlib/engine.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/OraPrereq.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/OraPrereqChecks.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/OraInstaller.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/OraInstallerNet.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/srvm.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/Scripts/ext/jlib/ojdl.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/Scripts/ext/jlib/ojdl2.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/Scripts/ext/jlib/ojdl-log4j.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/xmlparserv2.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/share.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java oracle.apps.ad.clone.util.FMWOracleHomePreReqCheck -prereqCheckFMW -e /u01/stu/app/fs1/inst/apps/STU_ebsdba2/appl/admin/STU_ebsdba2.xml -stage /u01/stu/app/fs1/EBSapps/comn/clone -log /u01/stu/app/fs1/EBSapps/comn/clone/FMW/logs/prereqcheck.log

Beginning application tier Apply - Wed Oct 22 14:03:29 2014

/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre/bin/java -Xmx600M -DCONTEXT_VALIDATED=true -Doracle.installer.oui_loc=/oui -classpath /u01/stu/app/fs1/EBSapps/comn/clone/jlib/xmlparserv2.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojdbc6.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/oui/OraInstaller.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/oui/ewt3.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/oui/share.jar:/u01/stu/app/fs1/FMW_Home/webtier/../Oracle_EBS-app1/oui/jlib/srvm.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojmisc.jar:/u01/stu/app/fs1/FMW_Home/wlserver_10.3/server/lib/weblogic.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/obfuscatepassword.jar  oracle.apps.ad.clone.ApplyAppsTier -e /u01/stu/app/fs1/inst/apps/STU_ebsdba2/appl/admin/STU_ebsdba2.xml -stage /u01/stu/app/fs1/EBSapps/comn/clone    -showProgress -nopromptmsg 
Log file located at /u01/stu/app/fs1/inst/apps/STU_ebsdba2/admin/log/clone/ApplyAppsTier_10221403.log
  -    100% completed       

Completed Apply...
Wed Oct 22 14:29:58 2014


 Executing command: /u01/stu/app/fs1/EBSapps/10.1.2/bin/sqlplus @/u01/stu/app/fs1/EBSapps/appl/ad/12.0.0/patch/115/sql/truncate_ad_nodes_config_status.sql


Do you want to startup the Application Services for STU? (y/n) [n] : 

Services not started

[applstu@ebsdba2 bin]$

将/u01/stu/app/fs1/中的EBSapps拷贝到fs2目录中。
运行fs2相应目录下的adcfgclone来配置fs2的克隆:

[applstu@ebsdba2 bin]$ perl adcfgclone.pl appsTier

                     Copyright (c) 2011 Oracle Corporation
                        Redwood Shores, California, USA

                        Oracle E-Business Suite Rapid Clone

                                 Version 12.2

                      adcfgclone Version 120.63.12020000.35

Enter the APPS password :  输入口令apps
Running:
/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre/bin/java -Xmx600M -classpath /u01/stu/app/fs1/EBSapps/comn/clone/jlib/obfuscatepassword.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojmisc.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/emCfg.jar oracle.apps.ad.clone.util.OPWrapper -encryptpwd /u01/stu/app/fs1/EBSapps/comn/clone/bin/../FMW/tempinfoApps.txt

Enter the Weblogic AdminServer password :  输入口令manager0
Running:
/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre/bin/java -Xmx600M -classpath /u01/stu/app/fs1/EBSapps/comn/clone/jlib/obfuscatepassword.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojmisc.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/emCfg.jar oracle.apps.ad.clone.util.OPWrapper /u01/stu/app/fs1/EBSapps/comn/clone/bin/../FMW/tempinfo.txt
Running:
/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre/bin/java -Xmx600M -classpath /u01/stu/app/fs1/EBSapps/comn/clone/jlib/obfuscatepassword.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojmisc.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/emCfg.jar oracle.apps.ad.clone.util.OPWrapper /u01/stu/app/fs1/EBSapps/comn/clone/bin/../FMW/EBSDataSource


Do you want to add a node (yes/no) [no] : 


Running:
/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre/bin/java -Xmx600M -cp /u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/xmlparserv2.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojdbc5.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/obfuscatepassword.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojmisc.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/emCfg.jar oracle.apps.ad.context.CloneContext -e /u01/stu/app/fs1/EBSapps/comn/clone/bin/../context/apps/CTXORIG.xml -validate -pairsfile /tmp/adpairsfile_4255.lst -stage /u01/stu/app/fs1/EBSapps/comn/clone  2> /tmp/adcfgclone_4255.err; echo $? > /tmp/adcfgclone_4255.res

Log file located at /u01/stu/app/fs1/EBSapps/comn/clone/bin/CloneContext_1023163359.log

Target System File Edition type [run] : patch

Enter the full path of Run File System Context file : /u01/stu/app/fs1/inst/apps/STU_ebsdba2/appl/admin/STU_ebsdba2.xml

--下面的目录为自动创建的目录:
Provide the values required for creation of the new APPL_TOP Context file.

Target System Fusion Middleware Home set to /u01/stu/app/fs2/FMW_Home

Target System Web Oracle Home set to /u01/stu/app/fs2/FMW_Home/webtier

Target System Appl TOP set to /u01/stu/app/fs2/EBSapps/appl

Target System COMMON TOP set to /u01/stu/app/fs2/EBSapps/comn

Target System Instance Top set to /u01/stu/app/fs2/inst/apps/STU_ebsdba2

Target System Port Pool [0-99] : 7

Checking the port pool 7
done: Port Pool 7 is free
Report file located at /u01/stu/app/fs2/inst/apps/STU_ebsdba2/admin/out/portpool.lst
Complete port information available at /u01/stu/app/fs2/inst/apps/STU_ebsdba2/admin/out/portpool.lst

UTL_FILE_DIR on database tier consists of the following directories.

1. /usr/tmp
2. /u01/stu/temp
3. /u01/stu/db/11.2.0/appsutil/outbound/STU_ebsdba1
4. /usr/tmp
Choose a value which will be set as APPLPTMP value on the target node [1] : 2

Creating the new APPL_TOP Context file from :
  /u01/stu/app/fs1/EBSapps/comn/clone/context/apps/adxmlctx.tmp

The new APPL_TOP context file has been created :
  /u01/stu/app/fs2/inst/apps/STU_ebsdba2/appl/admin/STU_ebsdba2.xml

Log file located at /u01/stu/app/fs1/EBSapps/comn/clone/bin/CloneContext_1023163359.log
Check Clone Context logfile /u01/stu/app/fs1/EBSapps/comn/clone/bin/CloneContext_1023163359.log for details.

Running Rapid Clone with command:
Running:
perl /u01/stu/app/fs1/EBSapps/comn/clone/bin/adclone.pl java=/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre mode=apply stage=/u01/stu/app/fs1/EBSapps/comn/clone component=appsTier method=CUSTOM appctxtg=/u01/stu/app/fs2/inst/apps/STU_ebsdba2/appl/admin/STU_ebsdba2.xml showProgress contextValidated=true



FMW Pre-requisite check log file location : /u01/stu/app/fs1/EBSapps/comn/clone/FMW/logs/prereqcheck.log

Running: /u01/stu/app/fs1/EBSapps/comn/clone/FMW/t2pjdk/bin/java -classpath /u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/Scripts/ext/jlib/engine.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/OraPrereq.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/OraPrereqChecks.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/OraInstaller.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/OraInstallerNet.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/srvm.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/Scripts/ext/jlib/ojdl.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/Scripts/ext/jlib/ojdl2.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/Scripts/ext/jlib/ojdl-log4j.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/xmlparserv2.jar:/u01/stu/app/fs1/EBSapps/comn/clone/prereq/webtier/oui/jlib/share.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java oracle.apps.ad.clone.util.FMWOracleHomePreReqCheck -prereqCheckFMW -e /u01/stu/app/fs2/inst/apps/STU_ebsdba2/appl/admin/STU_ebsdba2.xml -stage /u01/stu/app/fs1/EBSapps/comn/clone -log /u01/stu/app/fs1/EBSapps/comn/clone/FMW/logs/prereqcheck.log

Beginning application tier Apply - Thu Oct 23 16:34:56 2014

/u01/stu/app/fs1/EBSapps/comn/clone/bin/../jre/bin/java -Xmx600M -DCONTEXT_VALIDATED=true -Doracle.installer.oui_loc=/oui -classpath /u01/stu/app/fs1/EBSapps/comn/clone/jlib/xmlparserv2.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojdbc6.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/java:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/oui/OraInstaller.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/oui/ewt3.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/oui/share.jar:/u01/stu/app/fs2/FMW_Home/webtier/../Oracle_EBS-app1/oui/jlib/srvm.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/ojmisc.jar:/u01/stu/app/fs2/FMW_Home/wlserver_10.3/server/lib/weblogic.jar:/u01/stu/app/fs1/EBSapps/comn/clone/jlib/obfuscatepassword.jar  oracle.apps.ad.clone.ApplyAppsTier -e /u01/stu/app/fs2/inst/apps/STU_ebsdba2/appl/admin/STU_ebsdba2.xml -stage /u01/stu/app/fs1/EBSapps/comn/clone    -showProgress -nopromptmsg 
Log file located at /u01/stu/app/fs2/inst/apps/STU_ebsdba2/admin/log/clone/ApplyAppsTier_10231634.log

  /    100% completed       

Completed Apply...
Thu Oct 23 16:56:32 2014

Looking for incomplete CLONE record in ad_adop_session_patches table

The CLONE record status is no rows selected

Updating incomplete CLONE record to COMPLETED
[applstu@ebsdba2 bin]$

修改app的环境变量,并配置启、停服务器的脚本:

cat startApp.sh 
$INST_TOP/admin/scripts/adstrtal.sh apps/apps<<EOF
manager0
EOF

cat stopApp.sh 
$INST_TOP/admin/scripts/adstpall.sh apps/apps<<EOF
manager0
EOF
发表在 安装、克隆、迁移 | 标签为 , , | 一条评论

升级到11.2.0.4的一些发现-1-catupgrd.sql大致解读

升级到11.2.0.4的一些发现-2-其他发现
升级到11.2.0.4的一些发现-3-catalog.sql的主要内容

10.1的时候写了一个blog,由于当时blog出问题,丢失了,今天无意中找到这个丢失那篇blog的备份,补充上,O(∩_∩)O哈哈~
后续的第二篇,参见《升级到11.2.0.4的一些发现-2-其他发现
Rem Initial checks and RDBMS upgrade scripts

@@catupstr.sql  ---------主要是更新数据字典
	这个脚本执行过程中中,还需要依次调用:
	catupses.sql
	i0902000.sql------重整 props$,dependency$,mon_mods$。
				------之后,该脚本还调用i1001000.sql。i1001000调用i1002000.sql。
				------i1002000.sql调用i1101000.sql。i1002000.sql调用i1102000.sql。
	utlip_file.sql
	dbmsasrt.sql
	prvtasrt.plb

Rem catalog and catproc run with some multiprocess phases
@@catalog.sql –CATFILE -X
该脚本主要操作如下:

			--CATCTL -S    Initial scripts single process
			@@cdstrt  调用catpses.sql,其主要操作是:ALTER SESSION SET NLS_LENGTH_SEMANTICS=BYTE;
			@@cdfixed.sql  ---包含了很多 GoldenGate/XStream views based on Streams views 2011年就有了,还包含了大量创建基于基表的view
			@@cdcore.sql   ----基于核心基表创建了一些view,比如 ALL_TABLES,ALL_OBJECTS_AE,USER_CONSTRAINTS等等

			--CATCTL -M
			@@cdplsql.sql
			@@cdsqlddl.sql   -------- RECYCLEBIN在这个里面创建
			@@cdmanage.sql   -------- 创建了V$OBJECT_USAGE
			@@cdtxnspc.sql   --------  主要是2PC(两阶段提交的一些视图)
			@@cdenv.sql      --------  主要是profiles, resources等等(This script contains catalog views for objects in denv.bsq,比如USER_PASSWORD_LIMITS,ALL_USERS,DBA_PROFILES等等)
			@@cdrac.sql      ------- 主要是跟RAC相关的view,比如DBA_SERVICES
			@@cdsec.sql      ------- 主要是跟ROLE,Privilege相关的view
			@@cdobj.sql      ------- 主要是跟嵌套表相关的东西,比如 USER_NESTED_TABLE_COLS等等
			@@cdjava.sql
			@@cdpart.sql      ------- 主要是跟分区相关的view,例如 USER_PART_TABLES和ALL_PART_TABLES等等
			@@cdrep.sql      ------- 顾名思义,跟replicat相关的,他会调用创建CDC相关的view(catcdc.sql)
			@@cdaw.sql
			@@cdsummgt.sql  ------------ 也是跟物化视图和复制相关的view,例如 ALL_SUMDELTA。如果trace一下物化视图快速刷新,direct patch的操作就会被记录在:insert into sys.sumdelta$(而常规的加载是物化视图的基本原理,即基于internal trigger的方式记录在mlog$中)
			@@cdtools.sql  ------------ 主要是跟exp相关的view(exp_objects, exp_files等等),例如 DBA_EXP_OBJECTS,DBA_EXP_VERSION等等
			@@cdexttab.sql  ------- 主要是external table相关的view,例如 USER_EXTERNAL_TABLES
			@@cddm.sql   --------- Data Mining 相关的东西
			@@catldr.sql  --------  iews for the direct path of the loader


			--CATCTL -S     Final scripts single process
			@@cdoptim.sql  ---------跟统计信息相关的view,例如 TAB_COL_STATISTICS,ALL_TAB_COL_STATISTICS
			@@catsum.sql -----------主要还是跟DW应用中用到的一些管理视图相关,例如 DBA_DIM_LEVEL_KEY
			@@catexp.sql  ------- 创建跟exp/imp相关的所有对象
			@@cddst.sql -------DST相关的view
			@@cdend.sql ----主要操作:dbms_registry.loaded('CATALOG');

@@catproc.sql –CATFILE -X ——-设置 ALTER SESSION SET NLS_LENGTH_SEMANTICS=BYTE;

--CATCTL -S
Rem Final RDBMS upgrade scripts
@@catupprc.sql

Rem Upgrade components with some multiprocess phases
@@cmpupgrd.sql --CATFILE -X

--CATCTL -S
Rem Final upgrade scripts
@@catupend.sql

Rem Set errorlogging off
SET ERRORLOGGING OFF;

REM END OF CATUPGRD.SQL

REM bug 12337546 - Exit current sqlplus session at end of catupgrd.sql.
REM                This forces user to start a new sqlplus session in order
REM                to connect to the upgraded db.
exit

Rem *********************************************************************
Rem END catupgrd.sql
Rem *********************************************************************
发表在 Installation and Deinstall | 标签为 | 留下评论

11.2定时任务引起的系统负载异常—案例1

今天同事反映,周末新切换的一个数据库CPU load定期出现高峰,图形怪异:


无标题


检查了一下系统的定时任务:

09:41:05 sys@DSEDI>select job_name,state,JOB_CREATOR,JOB_ACTION,NUMBER_OF_ARGUMENTS from dba_scheduler_jobs order by 2;

JOB_NAME                       STATE           JOB_CREATOR                    JOB_ACTION                                              NUMBER_OF_ARGUMENTS
------------------------------ --------------- ------------------------------ ------------------------------------------------------- -------------------
XMLDB_NFS_CLEANUP_JOB          DISABLED        SYS                            xdb.dbms_xdbutil_int.cleanup_expired_nfsclients                           0
HM_CREATE_OFFLINE_DICTIONARY   DISABLED        SYS                            dbms_hm.create_offline_dictionary                                         0
FILE_WATCHER                   DISABLED        SYS
FGR$AUTOPURGE_JOB              DISABLED        SYS                            sys.dbms_file_group.purge_file_group(NULL);                               0
BSLN_MAINTAIN_STATS_JOB        SCHEDULED       SYS
DRA_REEVALUATE_OPEN_FAILURES   SCHEDULED       SYS                            dbms_ir.reevaluateopenfailures                                            4
RLM$EVTCLEANUP                 SCHEDULED       SYS                            begin dbms_rlmgr_dr.cleanup_events; end;                                  0
ORA$AUTOTASK_CLEAN             SCHEDULED       SYS
SM$CLEAN_AUTO_SPLIT_MERGE      SCHEDULED       SYS                            sys.dbms_streams_auto_int.clean_auto_split_merge;                         0
PURGE_LOG                      SCHEDULED       SYS
MGMT_STATS_CONFIG_JOB          SCHEDULED       SYS                            ORACLE_OCM.MGMT_CONFIG.collect_stats                                      0
MGMT_CONFIG_JOB                SCHEDULED       SYS                            ORACLE_OCM.MGMT_CONFIG.collect_config                                     0
RSE$CLEAN_RECOVERABLE_SCRIPT   SCHEDULED       SYS                            sys.dbms_streams_auto_int.clean_recoverable_script;                       0
RLM$SCHDNEGACTION              SCHEDULED       SYS                            begin dbms_rlmgr_dr.execschdactions('RLM$SCHDNEGACTION'                   0
                                                                              ); end;


14 rows selected.

09:41:58 sys@DSEDI>

10:00:07 sys@DSEDI>select log_date,owner,job_name,job_class 
10:00:07   2  from (select log_date,owner,job_name,job_class,status from dba_scheduler_job_log order by log_date desc)  
10:00:07   3  where rownum<=50
10:00:08   4  /

LOG_DATE                                                                    OWNER                          JOB_NAME                            JOB_CLASS
--------------------------------------------------------------------------- ------------------------------ ----------------------------------- ------------------------------
27-OCT-14 09.04.33.045472 AM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
27-OCT-14 09.00.15.621893 AM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
27-OCT-14 08.06.57.024628 AM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
27-OCT-14 08.00.15.642695 AM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
27-OCT-14 07.09.21.050342 AM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
27-OCT-14 07.00.15.639026 AM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
27-OCT-14 06.11.45.031676 AM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
27-OCT-14 06.00.15.641999 AM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
27-OCT-14 05.14.09.051620 AM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
27-OCT-14 05.00.15.641029 AM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
27-OCT-14 04.16.33.073416 AM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
27-OCT-14 04.00.15.639421 AM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
27-OCT-14 03.18.57.061664 AM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
27-OCT-14 03.00.15.649560 AM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
27-OCT-14 02.21.21.051382 AM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
27-OCT-14 02.00.15.638944 AM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
27-OCT-14 01.23.45.050094 AM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
27-OCT-14 01.00.15.631578 AM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
27-OCT-14 12.26.09.060165 AM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
27-OCT-14 12.00.15.642808 AM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
26-OCT-14 11.28.33.024408 PM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
26-OCT-14 11.00.15.620321 PM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
26-OCT-14 10.30.57.059413 PM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
26-OCT-14 10.10.54.204352 PM +08:00                                         SYS                            ORA$AT_OS_OPT_SY_609                ORA$AT_JCNRM_OS
26-OCT-14 10.10.54.203731 PM +08:00                                         SYS                            ORA$AT_OS_OPT_SY_609                ORA$AT_JCNRM_OS
26-OCT-14 10.10.54.202868 PM +08:00                                         SYS                            ORA$AT_OS_OPT_SY_609                ORA$AT_JCNRM_OS
26-OCT-14 10.10.21.146054 PM +08:00                                         SYS                            ORA$AT_SA_SPC_SY_610                ORA$AT_JCNRM_SA
26-OCT-14 10.10.21.145627 PM +08:00                                         SYS                            ORA$AT_SA_SPC_SY_610                ORA$AT_JCNRM_SA
26-OCT-14 10.10.21.145174 PM +08:00                                         SYS                            ORA$AT_SA_SPC_SY_610                ORA$AT_JCNRM_SA
26-OCT-14 10.10.06.680690 PM +08:00                                         SYS                            ORA$AT_SA_SPC_SY_610                ORA$AT_JCNRM_SA
26-OCT-14 10.10.06.675891 PM +08:00                                         SYS                            ORA$AT_OS_OPT_SY_609                ORA$AT_JCNRM_OS
26-OCT-14 10.10.06.668888 PM +08:00                                         SYS                            ORA$AT_SA_SPC_SY_610                ORA$AT_JCNRM_SA
26-OCT-14 10.10.06.661406 PM +08:00                                         SYS                            ORA$AT_OS_OPT_SY_609                ORA$AT_JCNRM_OS
26-OCT-14 10.10.06.654541 PM +08:00                                         SYS                            ORA$AT_OS_OPT_SY_609                ORA$AT_JCNRM_OS
26-OCT-14 10.10.06.651496 PM +08:00                                         SYS                            ORA$AT_OS_OPT_SY_609                ORA$AT_JCNRM_OS
26-OCT-14 10.00.15.624049 PM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
26-OCT-14 09.33.21.031707 PM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
26-OCT-14 09.00.15.622406 PM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
26-OCT-14 08.35.45.055836 PM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
26-OCT-14 08.00.15.682260 PM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
26-OCT-14 07.38.09.027828 PM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
26-OCT-14 07.00.15.649926 PM +08:00                                         EXFSYS                         RLM$EVTCLEANUP                      DEFAULT_JOB_CLASS
26-OCT-14 06.40.33.055890 PM +08:00                                         EXFSYS                         RLM$SCHDNEGACTION                   DEFAULT_JOB_CLASS
26-OCT-14 06.14.24.513691 PM +08:00                                         SYS                            ORA$AT_OS_OPT_SY_607                ORA$AT_JCNRM_OS
26-OCT-14 06.14.24.513393 PM +08:00                                         SYS                            ORA$AT_OS_OPT_SY_607                ORA$AT_JCNRM_OS
26-OCT-14 06.14.24.512879 PM +08:00                                         SYS                            ORA$AT_OS_OPT_SY_607                ORA$AT_JCNRM_OS
26-OCT-14 06.10.10.444293 PM +08:00                                         SYS                            ORA$AT_SA_SPC_SY_608                ORA$AT_JCNRM_SA
26-OCT-14 06.10.10.443353 PM +08:00                                         SYS                            ORA$AT_SA_SPC_SY_608                ORA$AT_JCNRM_SA
26-OCT-14 06.10.10.442373 PM +08:00                                         SYS                            ORA$AT_SA_SPC_SY_608                ORA$AT_JCNRM_SA
26-OCT-14 06.09.55.786026 PM +08:00                                         SYS                            ORA$AT_SA_SPC_SY_608                ORA$AT_JCNRM_SA

50 rows selected.

10:00:09 sys@DSEDI>

主要是resource manager的定时维护任务,因此手工关闭定是维护任务。
这里,EXFSYS是Oracle Expression Filter 组件的owner,根据mos的建议,可以卸载该组件:

[oracle@v5ecdb2 trace]$ ss

SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 27 09:28:57 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

09:28:57 sys@DSEDI>
11:02:00 sys@DSEDI>
11:02:01 sys@DSEDI>
11:02:01 sys@DSEDI>@$ORACLE_HOME/rdbms/admin/catnoexf.sql

PL/SQL procedure successfully completed.


User dropped.


Package dropped.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.

11:02:32 sys@DSEDI>

然后停止相关的自动维护的job:

11:05:34 sys@DSEDI>select OWNER,job_name,PROGRAM_NAME,ENABLED from dba_scheduler_jobs where owner='ORACLE_OCM';

OWNER                          JOB_NAME                       PROGRAM_NAME                        ENABL
------------------------------ ------------------------------ ----------------------------------- -----
ORACLE_OCM                     MGMT_CONFIG_JOB                                                    FALSE
ORACLE_OCM                     MGMT_STATS_CONFIG_JOB                                              FALSE

11:05:37 sys@DSEDI>select client_name,status from dba_autotask_client;

CLIENT_NAME                                                      STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection                                  ENABLED
auto space advisor                                               DISABLED
sql tuning advisor                                               DISABLED

11:05:42 sys@DSEDI>
11:05:42 sys@DSEDI>
11:06:40 sys@DSEDI>select * from v$rsrc_plan;

        ID NAME                             IS_TO CPU INS PARALLEL_SERVERS_ACTIVE PARALLEL_SERVERS_TOTAL
---------- -------------------------------- ----- --- --- ----------------------- ----------------------
PARALLEL_EXECUTION_MANAGED
--------------------------------
     12540 INTERNAL_PLAN                    TRUE  OFF OFF                       0                    640
FIFO


11:06:49 sys@DSEDI>

从zabbix上观察,11点02分操作完成后,到现在为止,系统已经平稳了,O(∩_∩)O哈哈~


无标题1


发表在 Performence Tuning | 标签为 | 留下评论

EBS-创建客户化应用

我这里的例子是创建一个名字叫做XXBL的应用

目录
1) Create A Custom Application Using adsplice 1
2) Verify Creation of Custom Product 9
2.定义和生成客户化应用的消息文件 9
1)重启应用使新增的客户化应用生效 9
2)定义消息 9
3)生成消息文件 10

EBS创建客户化应用操作-Lunar

发表在 EBS系统管理 | 标签为 , | 留下评论

EBS克隆–从已有的tar包克隆一套EBS(db和app在同一台机器上)

最近公司有EBS的项目,完了1周了,觉得很有意思。
下面记录了从一个已经克隆好的tar包开始,克隆出一套自己的EBS系统。
主要内容如下:

目录
硬件需求和环境 1
一、解开tar包和创建用户 1
创建用户 1
创建目录 1
创建OraInventory文件 2
解tar 2
修改目录权限 2
二、检查OS安装包 2
使用yum检查并安装缺少的package 2
Link to Motif library in Oracle Application Server 10.1.2 (on Oracle Linux 5, 6 and RHEL 5, 6 only) 3
三、禁用防火墙 4
九、解tar方式的target应用配置 4
设置数据库的读写目录 4
Clone DB的配置工作 4
Clone APP的配置工作 7
配置环境变量 19
配置DB的环境变量 19
App环境变量 19
应用的访问端口 20
Clone APP的配置工作-FS2 20
配置fs2的克隆 20
配置启停脚本 24

下载

发表在 安装、克隆、迁移 | 标签为 , , | 留下评论