Running sql queries in Liquibase

Make sure the user that you’ll use to issue this command will have privileges. In this query I create a user on Oracle DB

[code]

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">

<changeSet id="1.0.0_RBACK_USER" author="a243229">
<!– TO BE ABLE TO RUN THIS SCRIPT, MAKE SURE YOUR NON-SYS USER HAS SUCH PRIVILEGES OTHERWISE RUN THE BELOW COMMAND AS SYS GRANT CONNECT, RESOURCE, DBA, SYSDBA,
CREATE SESSION, CREATE PROCEDURE TO NON-SYS-USER-GOES-HERE; –>
<sql>CREATE USER RBAC_TEST
IDENTIFIED BY "rbactest1"
DEFAULT TABLESPACE SMALL_DATA
TEMPORARY TABLESPACE TEMP
PROFILE DEFAULT
ACCOUNT UNLOCK
</sql>
<sql>GRANT RESOURCE TO RBAC_TEST</sql>
<sql>GRANT CONNECT TO RBAC_TEST</sql>
<sql>ALTER USER RBAC_TEST DEFAULT ROLE ALL</sql>
<sql>GRANT CREATE JOB TO RBAC_TEST</sql>
<sql>GRANT CREATE SYNONYM TO RBAC_TEST</sql>
<sql>GRANT CREATE VIEW TO RBAC_TEST</sql>
<sql>GRANT UNLIMITED TABLESPACE TO RBAC_TEST</sql>
<sql>GRANT CREATE DATABASE LINK TO RBAC_TEST</sql>
<sql>ALTER USER RBAC_TEST QUOTA UNLIMITED ON USERS</sql>
<sql>ALTER USER RBAC_TEST QUOTA UNLIMITED ON LARGE_DATA</sql>
<sql>ALTER USER RBAC_TEST QUOTA UNLIMITED ON LARGE_INDEX</sql>
<sql>ALTER USER RBAC_TEST QUOTA UNLIMITED ON SMALL_DATA</sql>
<sql>ALTER USER RBAC_TEST QUOTA UNLIMITED ON LOB_DATA</sql>
<sql>ALTER USER RBAC_TEST QUOTA UNLIMITED ON SMALL_INDEX</sql>
<rollback>
<sql>DROP USER RBAC_TEST CASCADE</sql>
</rollback>
</changeSet>
</databaseChangeLog>

[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *