Archive Log Information

SELECT ‘ restore archivelog from logseq ‘ || applied_arc.startNo || ‘ until logseq ‘ || catalog_arc.endNo || ‘ thread=’ || catalog_arc.thread# || ‘;’ “Restore Command” FROM applied_arc, ( SELECT thread#, MAX (sequence#) startNo FROM gv$archived_log WHERE applied = ‘YES’ GROUP BY thread#) applied_arc, ( SELECT thread#, MAX (sequence#) endNo FROM v$backup_archivelog_details GROUP BY thread#) catalog_arc … Read more

How to stop and start RDS instance in AWS using Python

I’ve been working on a project that requires us to shutdown and startup our development databases to save costs.. I’ve come up with a python script to perform the tasks. This could be modified to your own requirements. Here is the code: import boto3 # Author: Mark Young # Date: 19th December 2017 # Detail: … Read more

InnoDB Information

SHOW ENGINE INNODB STATUS SHOW ENGINE INNODB MUTEX SHOW ENGINE {NDB | NDBCLUSTER} STATUS SHOW ENGINE PERFORMANCE_SCHEMA STATUS Displays extensive information from the standard InnoDB Monitor about the state of the InnoDB storage engine. There are four types of InnoDB monitors: • The standard InnoDB Monitor displays the following types of information: • Work done … Read more

Calculate MySQL Size

How to calculate the table and database size in MySQL SELECT table_schema “Data Base Name”, sum( data_length + index_length) / 1024 / 1024 “Data Base Size in MB” FROM information_schema.TABLES GROUP BY table_schema ; and SELECT table_name, table_rows, data_length, index_length, round(((data_length + index_length) / 1024 / 1024),2) “Size in MB” FROM information_schema.TABLES where table_schema = … Read more

Calculate Table Size in MySQL

How to calculate all tables in a schema SELECT TABLE_NAME AS “Table Name”, table_rows AS “Quant of Rows”, ROUND( ( data_length + index_length ) /1024, 2 ) AS “Total Size Kb” FROM information_schema.TABLES WHERE information_schema.TABLES.table_schema = ‘YOUR SCHEMA NAME/DATABASE NAME HERE’ LIMIT 0 , 30;

How to create a SSL connection between Oracle 10.2.0.5 and Amazon Aurora Data Migration Services

Amazon have documented this process, however this is for 11g source Oracle database only, and there are a few steps that must be adhered to in order to get this to work. Please note, there are a few changes from 10g to 11g using orapki, specifically with the auto_login command. Please set your Oracle environment … Read more

Command Line Connection with MYSQL

If you are wanting to connect to a remote database using the command line with MySQL, you first need to download the MYSQL client available here Open a DOS shell and run the following: mysqlsh /sql -u aurora -p mypassword -h auroratest-1.cluster-xxxx.ap-southeast-2.rds.amazonaws.com AURORATEST Then run your query mysql-sql> select count(*) from AURORA.PERSON_AWS; +———-+ | count(*) … Read more

Lambda Function in Aurora

How to create a lambda function to insert some records in an Aurora Database in AWS. Here is some sample code. This will enable us to link to databases in AWS to perform some functions. import sys import logging import rds_config import pymysql #rds settings rds_host = “auroratest.xxxx.ap-southeast-2.rds.amazonaws.com” name = rds_config.db_username password = rds_config.db_password db_name … Read more