lunes, 30 de julio de 2012

Cómo saber el tamaño de tus bases de datos 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 ;

lunes, 16 de julio de 2012

Ocultar bases de datos sql

------------ BEGIN SQL -------------------

USE [master]
GO
-- make sure they can view all databases for the moment.
GRANT VIEW ANY DATABASE TO UserLoginName_HERE
GO

USE DataBaseName_HERE
go

-- drop the user in the database if it already exists.
IF EXISTS (SELECT *
FROM sys.database_principals
WHERE name = N'UserLoginName_HERE')
DROP USER UserLoginName_HERE
GO

-- grant them ownership to of the database (ownership of dbo schema).
ALTER AUTHORIZATION ON DATABASE::DataBaseName_HERE to UserLoginName_HERE
go

USE MASTER
go

-- deny ability to see ohter databases
DENY VIEW ANY DATABASE TO UserLoginName_HERE
go

------------ END SQL -------------------