Two scripts to remember:
MS-SQL Create Database
CREATE DATABASE ${dbName}
GO
DECLARE @size int
SELECT @size = size*8
FROM ${dbName}..sysfiles WHERE name = N'${dbName}'
IF @size < 5000
BEGIN
ALTER DATABASE [${dbName}] MODIFY FILE(NAME=N'${dbName}', SIZE=5MB)
END
ALTER DATABASE [${dbName}] MODIFY FILE(NAME=N'${dbName}', FILEGROWTH=5MB)
SELECT @size = size*8
FROM ${dbName}..sysfiles WHERE name = N'${dbName}_log'
IF @size < 10000
BEGIN
ALTER DATABASE [${dbName}] MODIFY FILE(NAME=N'${dbName}_log', SIZE=10MB)
END
ALTER DATABASE [${dbName}] MODIFY FILE(NAME=N'${dbName}_log', FILEGROWTH=50MB)
ALTER DATABASE [${dbName}] ADD FILEGROUP userdata001
DECLARE @FilePath nvarchar(250)
SELECT @FilePath = LEFT(filename, LEN(filename) - CHARINDEX(N'\', REVERSE(filename))) FROM master.dbo.sysdatabases WHERE name = N'${dbName}'
SET @FilePath = @FilePath+ '\${dbName}_data001.ndf'
EXEC ('ALTER DATABASE [${dbName}] ADD FILE (NAME = N''${dbName}_data001'',FILENAME = '''+@FilePath+''',SIZE = 200MB,FILEGROWTH = 50MB) TO FILEGROUP userdata001')
ALTER DATABASE [${dbName}] MODIFY FILEGROUP userdata001 DEFAULT
GO
Oracle - Create User
CREATE USER TEST_USER IDENTIFIED BY TEST_USER
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP;
GRANT "CONNECT" TO TEST_USER;
GRANT CREATE SEQUENCE TO TEST_USER;
GRANT CREATE TABLE TO TEST_USER;
GRANT CREATE TRIGGER TO TEST_USER;
GRANT UNLIMITED TABLESPACE TO TEST_USER;
GRANT CREATE VIEW TO TEST_USER;
GRANT CREATE PROCEDURE TO TEST_USER;
ALTER USER TEST_USER DEFAULT ROLE ALL;
1 comment:
Thank you! I searched this for a long time! :D
Post a Comment