Tag: useful

Databases, Microsoft SQL Server

Retrieve useful information from SQL Server

Today we will see how can we retrieve various information from Microsoft SQL Server using SQL queries. Get all users: SELECT * FROM sys.server_principals;SELECT * fROM sys.server_principals; Get database size: USE master GO   EXEC sp_spaceuseduse master go exec sp_spaceused Get user privilleges for current database: USE master GO   SELECT SYSOBJECTS.name AS ‘objectname’, SYSUSERS.name …

Databases, MySQL

Retrieve useful information from MySQL

Today we will see how can we retrieve various information from mysql server using SQL queries. Get all users: SELECT * FROM mysql.user;select * from mysql.user; Get top 10 tables in size: SELECT concat(table_schema,’.’,TABLE_NAME) TABLE_NAME, concat(round(data_length/(1024*1024),2),’M’) data_length FROM information_schema.TABLES ORDER BY data_length DESC LIMIT 10;SELECT concat(table_schema,’.’,table_name) table_name, concat(round(data_length/(1024*1024),2),’M’) data_length FROM information_schema.TABLES ORDER BY data_length DESC …

Apache, Linux

Retrieve useful information from Apache logs

Common locations where you can find Apache logs are /var/log/apache2 and /var/log/httpd/. You can extract valuable information from your apache logs. Here are some useful examples! Extract unique IP addresses: cat /var/log/apache2/access.log | awk ‘{print $1}’ | sort | uniqcat /var/log/apache2/access.log | awk ‘{print $1}’ | sort | uniq   Extract unique IP addresses with …