- 博客(32)
- 收藏
- 关注
原创 PostgreSQL篇
PG的逻辑架构为:instance -> database -> schema -> table。和Oracle不同的是PG的用户不同于schema;和MySQL不同的是,PG的database下还有schema。
2022-02-16 17:32:43
572
原创 MySQL 数据导入导出
数据导入导出,LOAD DATA LOCAL INFiLE方法一、LOAD DATA LOCAL INFiLE目标端创建好表索引导入数据,命令:mysql -P 端口 -u 用户 -p -e" LOAD DATA LOCAL INFiLE '/xxxxxx/xxxxx.txt' INTO TABLE 库名.表名 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';"...
2021-10-15 16:40:26
124
原创 Oracle session分析
sessionset linesize 300 pages 999 col sid format 99999 col s# format 99999 col username format a10 col spid for a10 col event format a36 col m...
2021-09-29 11:17:21
369
原创 informix
onstat -lonstat -donstat -g dri逻辑日志:推荐逻辑日志的大小(50000k*逻辑日志数)大约为数据量的十分之一$onparams -a -d llogdbs -s 50000 #k为单位以下脚本直接添加150个(8G)逻辑日志i=1while [ "$i" -le 150 ]doonparams -a -d llogdbs -s 50000i=$((i+1))done切换逻辑日志 /*切换的次数等于新增逻辑日志的个数$onmode -l..
2021-09-29 10:03:13
122
原创 Oracle 分析表
分析表select owner,table_name,TABLESPACE_NAME from dba_tables where table_name=upper('&1');select OWNER,INDEX_NAME,TABLE_OWNER,TABLE_NAME,STATUS from dba_indexes where TABLE_NAME='&1';select a.column_name, b.num_rows, a.num_distinct C...
2021-09-29 09:46:01
698
原创 Oracle awr ash
获取awr ash[ashrpt]@?/rdbms/admin/ashrpt.sql[awrddrpt]@?/rdbms/admin/awrddrpt.sql[awrsqrpt.sql]@?/rdbms/admin/awrsqrpt.sql[awrrpt]@?/rdbms/admin/awrrpt.sql示例:SQL> @?/rdbms/admin/awrrpt.sql....Enter value for report_type: html....Enter .
2021-09-19 22:50:01
105
原创 Oracle 回收站
检查回收站数据量select count(*) from dba_recyclebin;手动清理purge dba_recyclebin;
2021-09-19 21:54:14
62
原创 Oracle 用户 权限 角色
oracle中新建用户,赋予权限,撤销权限,查看权限,角色新建用户create user 用户名 identified by "密码"; #新建用户alert user 用户名 identified by "新密码"; #修改用户密码赋予权限grant dba to 用户名; #给用户赋予所有权限(connect是赋予连接数据库的权限,resource是赋予用户只可以创建实例但是没有创建数据结构的权限)grant create session to 用户名; #给用户赋予登录的权...
2021-09-19 21:16:32
438
原创 Oracle 归档操作
查询归档日志总大小show parameter db_recovery_file_dest_size;增大归档日志空间alter system set db_recovery_file_dest_size=20G;查看当前归档日志使用大小,单位Bselect * from v$recovery_file_dest;查看当前用了多少归档日志了(按百分比)select * from v$flash_recovery_area_usage; #如果 ARCHIVED LOG 超过90%有宕机的危险.
2021-09-19 20:27:43
1059
原创 Oracle 用rman删除主库的归档出现RMAN-08137
11g dataguard 环境中用rman删除主库的归档,出现RMAN-08137:WARNING: archived log not deleted, needed for standby or upstream capture process通过下述两个sql检查,发现主库的归档都已经应用到standby库select max(sequence#) from v$archived_log;select max(sequence#) from v$archived_log where ...
2021-09-18 21:59:28
2683
原创 Oracle 删除归档
如何正确地删除Archivelog?Archivelog并不能直接得从OS层直接物理删除,因为archivelog的相关信息是记录在controlfile中的,当物理删除后不会改变controlfile的设置,并且在查询相关的动态视图(例如v$archived_log)时,该部分日志仍然标注为存在,也就是说Oracle并不认为这些日志被删除了,所以在删除archivelog的时候,需要我们在其他地方做一些设置。一、使用RMAN清除物理删除后的记录可以使用RMAN来删除archivelog,具体可..
2021-09-18 21:29:22
4602
原创 Oracle 参数
Oracle参数的修改比较复杂,有些参数是可以在session级别修改,有些则必须在system级别修改,有些参数修改后马上生效(不需要重启),有些参数则必须重启才能生效,那么我们如何知道这些信息呢?v$parameter 可以查询动态视图v$parameter中的两列得知:1.ISSES_MODIFIABLE 指示参数是否可以在session级别(Alter session set)修改(True or False)2.ISSYS_MODIFIABLE 指示参数是否可以在syste...
2021-09-13 18:29:03
335
原创 Oracle RAC
RAC异常重启分析-----信息收集命令:/u01/app/grid/grid_home/tfa/bin/tfactl diagcollect -from "Aug/5/2020 22:00:00" -to "Aug/5/2020 23:00:00"-----如果命令执行报错,使用下面命令启动tfa后再执行收集:/u01/app/grid/grid_home/tfa/bin/tfactl start修改KDUMP和重启-----修改KDUMP配置root执行,crsctl 用绝对路径:.
2021-09-10 20:50:36
270
原创 Oracle 文件自动扩展
检查自动扩展是否打开:SELECT T.TABLESPACE_NAME,D.FILE_NAME,D.AUTOEXTENSIBLE,D.BYTES,D.MAXBYTES,D.STATUSFROM DBA_TABLESPACES T,DBA_DATA_FILES DWHERE T.TABLESPACE_NAME =D.TABLESPACE_NAME and D.AUTOEXTENSIBLE != 'NO' ORDER BY TABLESPACE_NAME,FILE_NAME;文件自动扩展问题---..
2021-09-10 11:20:53
885
转载 MySQL 恢复delete的操作
1.binlog功能是否开启show variables like '%log_bin%';如果为log_bin为ON说明可以恢复,如果为OFF说明没有开启binlog,也没有预先生成回滚SQL,那可能真的无法快速回滚了,GAMEOVER(好像可以通过ibd恢复,具体可以参考 https://blog.csdn.net/hanjun0612/article/details/102466509)2.根据操作时间找到binlog3.通过mysqlbinlog恢复删除的数据日志记录mysqlbin
2021-09-10 10:33:17
1786
原创 MySQL MGR篇
查看MGR secondary 节点延迟select t1.SERVICE_STATE as IO_RUNNING, t2.SERVICE_STATE as SQL_RUNNING, t1.LAST_ERROR_NUMBER as LAST_IO_ERRNO, t2.LAST_ERROR_NUMBER as LAST_SQL_ERRNO, t1.LAST_ERROR_MESSAGE as LAST_IO_ERROR, t2.LAST_ERROR_MESS...
2021-08-24 12:24:28
190
原创 Oracle 查找执行过的sqltext
方式一:SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(to_char('&sql_id'),NULL));方式二:select sql_text from v$sqltext where sql_id='&sqlid' and address = (select address from v$sqltext where sql_id ='&sqlid' and piece=0 and rownum<2) order by pie
2021-08-12 10:54:05
1107
原创 MySQL The table ‘/mysqldata/mysqltmp/#sql482e_2f6f60_3b‘ is full!
遇到报错:[ERROR] [MY-013132] [Server] The table '/mysqldata/mysqltmp/#sql482e_2f6f60_3b' is full![ERROR] [MY-013132] [Server] The table '/mysqldata/mysqltmp/#sql482e_2f6f7a_1e' is full![ERROR] [MY-013132] [Server] The table '/mysqldata/mysqltmp/#sql482e_2f
2021-08-11 15:06:07
1125
原创 MySQL 会话&事务
查询会话show full processlist;完整sqltextselect * from information_schema.PROCESSLIST;select id, db, user, host, command, time, state, info from information_schema.processlist order by time desc;select id, db, user, host, command, time, state, left(info
2021-08-03 01:00:53
714
原创 MySQL 表(表名含有大写字母的所有表)
select table_namefrom information_schema.tableswhere table_schema='databasename' and binary table_name REGEXP '[A-Z]';
2021-08-03 00:52:42
557
原创 MySQL Router 安装学习研究(二)
安装介质mysql-router-8.0.24-linux-glibc2.12-x86_64.tar.xz上传目录/home/mysql(自选目录)解压tar -Jxvf mysql-router-8.0.24-linux-glibc2.12-x86_64.tar.xz配置环境变量vi .bash_profilePATH=/mysql/mysql80/bin:/home/mysql/mysql-router-8.0.24-linux-glibc2.12-x86_64/bin:
2021-08-03 00:13:48
264
原创 Oracle RMAN-06429: TARGET database is not compatible with this version of RMAN
备份遇到错误:RMAN-06429: TARGET database is not compatible with this version of RMAN检查软件版本opatch lspatches实例数据字典中版本SQL> select * from v$version;SQL> set lines 200 pages 1000SQL> col COMMENTS for a40SQL> select ACTION_TIME, ACTION, COMME
2021-08-02 21:58:58
923
原创 Oracle DG GAP
确定增备scn范围,通过alert日志获取gap日志序列/u01/oracle/diag/rdbms/<sid>/<sid>/trace/ alert日志GAP - thread 1 sequence 76893-76992利用磁带备份处理GAP1.在主库上select 'catalog device type '|| '''SBT_TAPE''' ||' backuppiece ''/'||HANDLE||''';' from (select distinct a..
2021-07-29 10:13:09
195
原创 Oracle组件
检查promp check db compcol COMP_NAME for a40col status for a10col version for a15select/*+gather_plan_statisticsmonitorpart: db_info.sqlsubpart: db_comp*/comp_name,version,statusfrom dba_registryorder by 1/promp输出:COMP_NAME ...
2021-07-29 10:08:48
126
原创 Oracle索引
当前索引状态-----dba_indexesselect OWNER,INDEX_NAME,STATUS from dba_indexes where INDEX_NAME='&indexname';select owner,index_name ,status from dba_indexes where table_name='&tablename';select table_owner,table_name from dba_indexes where index_na
2021-07-27 16:42:14
539
原创 Oracle查询(对象)权限
set linesize 300 pagesize 900col GRANTEE for a20col owner for a15col TABLE_NAME FOR A40col PRIVILEGE FOR A10select GRANTEE,OWNER,TABLE_NAME,PRIVILEGE from dba_tab_privs where TABLE_NAME =upper('&table') order by PRIVILEGE;--------- dba_tab...
2021-07-27 15:26:39
394
原创 ORA-17503: ksfdopn:2 Failed to open file +XXX_DATA01/xxx/standbyfile/stdredo80.log
报错信息:select 'ERROR DG standby redolog transport delay 3600s',status,FIRST_TIME,LAST_TIME from v$standby_log *ERROR at line 1:ORA-00308: cannot open archived log '+X...
2021-07-21 18:49:45
895
原创 Oracle 查询表结构
set linesize 3000set long 30000set pagesize 3000select dbms_metadata.get_ddl('TABLE','table_name','owner') from dual;
2021-07-21 18:44:03
586
1
原创 Oracle 18c checkpoint_time时间不准问题
SQL> select scn_to_timestamp(current_scn) from v$database;SCN_TO_TIMESTAMP(CURRENT_SCN)---------------------------------------------------------------------------2021-03-05 16:49:52.000000000动态的设置:alter system set "_time_based_rcv_ckpt_target"=0
2021-07-21 18:38:47
272
原创 Oracle DG 延迟
查询:select systimestamp-sys.scn_to_timestamp(current_scn) from v$database;set line 200;col NAME for a25;col UNIT for a30;col VALUE for a20;select name,value,unit,time_computed from v$dataguard_stats;
2021-07-19 19:05:49
1947
原创 Oracle DG重启
shutdown immediate;startup nomount;alter database mount standby database;alter database open read only;alter database recover managed standby database using current logfile disconnect from session;
2021-07-19 13:49:44
621
转载 MySQL Router 功能学习研究(一)
#MySQL Router###简介MySQL Router最早是作为MySQL-Proxy的替代方案出现的。作为一个轻量级中间件,MySQL Router可在应用程序和后端MySQL服务器之间提供透明路由和负载均衡,从而有效提高MySQL数据库服务的高可用性与可伸缩行。###功能介绍####透明路由MySQL Router通过智能地将客户端连接路由到MySQL服务器。MySQL使用组复制在多个服务器之间复制数据,当服务器发生故障时执行自动故障转移,基于paxos协议在剩余实例中选举一个新
2021-07-19 11:09:34
345
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人