装完了cluster,我们来装DB。在上一篇 我已经说了,在leaf node上是不允许装DB的(至少目前如此),所以我们只能在hub node上安装。 你可以在hub node上装单实例DB,也可以装rac one node,也可以装rac。我这里想安装成2节点的rac。但是目前我只有2个node […]
12c flex cluster小记(1)
这篇文章其实在草稿箱里面躺了快1年了,只是太长,长的我都没有信心完成它了。不过,放着可惜,还是拆分一下share出来吧。 关于flex cluster 1. 有hub node和leaf node的概念,目前数据库只能放在hub node,leaf node据说是用于放耦合度较低的服务,如weblo […]
mysql学习笔记
说实在话,我接触过mysql唯一的机会是更新我的wordpress的博客。mysql对我来说绝对是个陌生的领域。 有幸旁听了一次mysql的培训,受益匪浅,做一下笔记以备后面继续学习的时候可以查阅。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
MySQL结构: connector(native c api,jdbc,odbc) connection pool sql interface,parser,optimizer,cache and buffer pluggable storage engines(myisam,innodb,bdb,memory,archive...) file system, 企业版:cluster,partition backup,security 存储引擎 myisam:表锁,3个文件定义一个表,不支持事物、外键约束,适合读取 innodb:支持事物,行锁,有缓冲池,在关闭autocommit的情况下,和myisam性能类似。 memory:临时中转表 参数文件:my.cnf (my.ini在windows上),show variables like '%xxxxx%' 日志文件:(1)错误日志文件 show variables like '%log_err%'可以找到错误日志文件的路径。(2)查询日志文件,show variables like '%general%' 平时关闭。(3)慢查询日志文件 show variables like '%slow%'; 可能会导致文件体积过大 (4)二进制日志文件,也就是归档文件 socket文件: pid文件:mysql进程起来后,会把进程写到该文件 表定义文件:frm文件,明文,可以看表结构定义 数据文件:ibd文件,以innodb引擎的数据文件 启动: /etc/init.d/mysql start 或者/usr/bin/mysqld_safe & 或者$MYSQL_HOME/bin/mysql_safe & 关闭: mysqladmin -uroot -p shutdown 连接: mysql -h <host IP address> --protical=TCP -port 3318 -u <username> -p <password> use <instance_name> show tables; sekect * from <table_name>; 用户 用户名格式:username@hostname 如jimmy@hostname create user <username> identified by <password>; grant usage on *.* to <user>; show grant for <user>; mysql> select user,host from mysql.user; --mysql库的user表 mysql> show grants for deployer@'%'; mysql库 information_schema库:记录了元数据 帮助: help show database help show processlist \G 注:\G表示行转列,方便显示结果 mysql支持的数据类型:数字类型,字符类型,日期类型,null 字符集 mysql安全管理: 创建用户制定IP等等 mysql数据库备份:全备和备份binlog mysql vs oracle 垂直扩展性 oracle:可以通过增加多个cpu提升处理能力 mysql:在5.6之前,提升不高 oracle:使用SAN mysql:本地盘 高可用: oracle:vcs,rac,dg/adg,ogg mysql:replicate 主从 mysql replicate: GTID的复制:GTID即global transaction ID,mysql 5.6以上 master slave:I/O thread(读取binlog,写入到relay log), sql thread(读取relay log,replay relay log。写入到当前slave库) mysql> show slave status \G 异步:生成binlog后,不会管是否传输到slave 半同步:传一个binlog为relay log,会自动降级为异步模式。 mysql优化: 参数优化:最大连接数,缺省字符集,缺省存储引擎,键缓存大小(给myisam用),innodb缓冲池大小,innodb引擎字典缓冲,查询缓冲大小,设置表缓冲,慢查询时间,慢查询日志,超时设置参数 注,几个和oracle不太一样的参数: autocommit=no(建库时需要为on) sql_mode=strict_trans_tables,no_auto_create_user,no_auto_value_on_zero transaction isolation=read-committed 数据库状态: 1.看累计状态 mysql>status 2.看线程状态: mysql> show processlist 3.看全局运行状态 mysql> show global status |
12c的网络设置
12c开始,对于pdb一般都是需要tnsname登录了,在这里记录一下主要的3个网络文件配置。 listener.ora
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# listener.ora Network Configuration File: /u01/ora12c/app/oracle/product/12.1.0/db_1/network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = ora12c) (ORACLE_HOME = /u01/ora12c/app/oracle/product/12.1.0/db_1) (SID_NAME = ora12c) ) (SID_DESC = (GLOBAL_DBNAME = pdb1) (ORACLE_HOME = /u01/ora12c/app/oracle/product/12.1.0/db_1) (SID_NAME = ora12c) ) ) LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.132)(PORT = 1522)) ) ADR_BASE_LISTENER = /u01/ora12c/app/oracle |
tnsnames.ora
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# tnsnames.ora Network Configuration File: /u01/ora12c/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. ORA12C = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.132)(PORT = 1522)) ) (CONNECT_DATA = (SERVICE_NAME = ora12c) ) ) PDB1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.132)(PORT = 1522)) ) (CONNECT_DATA = (SERVICE_NAME = pdb1) ) ) |
sqlnet.ora […]
如何还原virtualbox导出的RAC镜像文件
在virtualbox中建立虚拟机,往往是3个文件夹:节点1(ol6-121-rac1),节点2(ol6-121-rac2),共享存储文件夹(ol6-121-rac)。当我们选择“管理”-“导出虚拟电脑”,导出成ova文件备份,就能看到2个主机,每个主机一个ova文件。另外,细心的你可能会发现,在备 […]
小谈12c的in memory option
(1) in memory option(以下简称imo)将随着12.1.0.2发布 (2)in memory option不会取代TimesTen(以下简称TT),因为这是2种层面的产品,TT还是会架在DB层之前,和应用紧密相连,为应用提供缓存,imo在DB层,可以做到高可用如RAC,DG等一些T […]
控制文件丢失的恢复
1. rman设置自动备份的情况(CONFIGURE CONTROLFILE AUTOBACKUP ON ),可以 注:11g自动备份的控制文件是放在FRA区:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
RMAN> restore controlfile from autobackup; Starting restore at 15-NOV-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=63 device type=DISK recovery area destination: e:\ora11g\app\oracleuser\flash_recovery_area database name (or database unique name) used for search: ORA11G channel ORA_DISK_1: AUTOBACKUP E:\ORA11G\APP\ORACLEUSER\FLASH_RECOVERY_AREA\ORA11G\AUTOBACKUP\2013_11_15\O1_MF_S_831574477_98CRBG12_.BKP found in the recovery area AUTOBACKUP search with format "%F" not attempted because DBID was not set channel ORA_DISK_1: restoring control file from AUTOBACKUP E:\ORA11G\APP\ORACLEUSER\FLASH_RECOVERY_AREA\ORA11G\AUTOBACKUP\2013_11_15\O1_MF_S_831574477_98CRBG12_.BKP channel ORA_DISK_1: control file restore from AUTOBACKUP complete output file name=E:\ORA11G\APP\ORACLEUSER\ORADATA\ORA11G\CONTROL01.CTL output file name=E:\ORA11G\APP\ORACLEUSER\FLASH_RECOVERY_AREA\ORA11G\CONTROL02.CTL Finished restore at 15-NOV-13 RMAN> RMAN> restore database; Starting restore at 15-NOV-13 Starting implicit crosscheck backup at 15-NOV-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=191 device type=DISK Crosschecked 20 objects Finished implicit crosscheck backup at 15-NOV-13 Starting implicit crosscheck copy at 15-NOV-13 using channel ORA_DISK_1 Finished implicit crosscheck copy at 15-NOV-13 searching for all files in the recovery area cataloging files... cataloging done List of Cataloged Files ======================= File Name: E:\ORA11G\APP\ORACLEUSER\FLASH_RECOVERY_AREA\ORA11G\ARCHIVELOG\2013_11_07\O1_MF_1_509_97POOJ85_.ARC File Name: E:\ORA11G\APP\ORACLEUSER\FLASH_RECOVERY_AREA\ORA11G\AUTOBACKUP\2013_11_15\O1_MF_S_831574477_98CRBG12_.BKP using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00001 to E:\ORA11G\APP\ORACLEUSER\ORADATA\ORA11G\SYSTEM01.DBF channel ORA_DISK_1: restoring datafile 00002 to E:\ORA11G\APP\ORACLEUSER\ORADATA\ORA11G\SYSAUX01.DBF channel ORA_DISK_1: restoring datafile 00003 to E:\ORA11G\APP\ORACLEUSER\ORADATA\ORA11G\UNDOTBS01.DBF channel ORA_DISK_1: restoring datafile 00004 to E:\ORA11G\APP\ORACLEUSER\ORADATA\ORA11G\USERS01.DBF channel ORA_DISK_1: restoring datafile 00005 to E:\USERS2_FOR_TEMP_USE.DBF channel ORA_DISK_1: reading from backup piece C:\FULL_9OOP1K9R_1_312.RMN channel ORA_DISK_1: piece handle=C:\FULL_9OOP1K9R_1_312.RMN tag=TAG20131115T165211 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:01:35 Finished restore at 15-NOV-13 RMAN> recover database; Starting recover at 15-NOV-13 using channel ORA_DISK_1 starting media recovery archived log for thread 1 with sequence 25 is already on disk as file E:\ORA11G\APP\ORACLEUSER\ORADATA\ORA11G\REDO25.LOG archived log file name=E:\ORA11G\APP\ORACLEUSER\ORADATA\ORA11G\REDO25.LOG thread=1 sequence=25 media recovery complete, elapsed time: 00:00:02 Finished recover at 15-NOV-13 RMAN> alter database open resetlogs; database opened RMAN> RMAN> |
2.rman一般会配置snapshot(CONFIGURE SNAPSH […]
12c的架构图
在微博上看到12c的架构图了,在这里也放一下。一是给自己做个笔记,另一方面也方便各位oracle爱好者。 顺便整理了一下,9i到12c的数据库架构图,都是pdf版本的: (1)Db9i_Server_Arch (2)Db10g_Server_Arch (3)Db11g_Server_Arch (4) […]
基于vbox的12c RAC的安装
总体上说,12c RAC的安装基本和11g的一致。 先整个简单版的12c RAC(不启用dns,不启用flex cluster,不启用admin policy),基于Oracle Linux Release 6 Update 4 for x86_64 (64 Bit),安装在virtualbox 4 […]
11g RAC的删除
记得原来在10g RAC的时候,清除RAC还要删除很多东西。有一次某客户的10RAC装不起来,OUI安装数据库时,一直卡在83%,后来查了才发现是没有清除/etc/oratab文件中的信息,导致一直在读取之前的几个实例的信息,由于其他相关的信息,如inventory中的信息已经删除,所以一直卡在83 […]
11.2.0.1的RAC的迁移和升级到11.2.0.3
某客户有套RAC系统,需要一个主机迁移到另一主机,并且要求升级到11.2.0.3。这项任务其实包含了2个工作,迁移和升级。如果单纯的迁移,直接rman过去就好了;如果单纯的升级,其实比较好做,GI可以滚动升级,DB升级需要downtime。但是配合着迁移来做,就要考虑下如何更好的减少downtime […]
12c的sqlplus提示符
12发布了。有别于11g和之前版本,如果我需要登录sqlplus之后,清楚的了解我所登录的数据库,我们可以加一个[数据库类型],如: 在11g中,还是用老的提示符,如以sys用户登录数据库,instance名叫ORA11G:
1 |
sys@ORA11G(192.168.190.1)> |
在12c […]