USE ROLE SYSADMIN;
CREATE DATABASE DEVSNOW1;
Database DEVSNOW1 successfully created.
Example 2. Create database with a comment
USE ROLE SYSADMIN;
CREATE DATABASE DEVSNOW2 COMMENT="Development Environment 2";
Database DEVSNOW2 successfully created.
Example 3. Create database, replacing existing database with the same name
USE ROLE SYSADMIN;
-- First lets see what error we get if we try to create db that already exists
SQL compilation error: Object 'DEVSNOW1' already exists.
CREATE OR REPLACE DATABASE DEVSNOW1;
Database DEVSNOW1 successfully created.
Example 4. Create database only if it does not exist already
USE ROLE SYSADMIN;
CREATE DATABASE IF NOT EXISTS DEVSNOW1;
DEVSNOW1 already exists, statement succeeded.
-- notice db already exists message
CREATE DATABASE IF NOT EXISTS DEVSNOW3;
Database DEVSNOW3 successfully created.
Example 5. Create a Transient database i.e. FAILSAFE disabled
USE ROLE SYSADMIN;
CREATE TRANSIENT DATABASE DEVSNOW4 COMMENT="Development Environment NO FAILSAFE";
Database DEVSNOW4 successfully created.
Example 6. Create database Clone
USE ROLE SYSADMIN;
CREATE DATABASE DEVSNOW3CLONE1 CLONE DEVSNOW3;
Database DEVSNOW3CLONE1 successfully created.
-- Note we can not clone a Transient database
CREATE DATABASE DEVSNOW4CLONE1 CLONE DEVSNOW4;
SQL compilation error: Transient object cannot be cloned to a permanent object.
Example 7. Create database clone from a point in the past
USE ROLE SYSADMIN;
-- Timestamp AT example
CREATE DATABASE DEVSNOW3CLONE2 CLONE DEVSNOW3 AT (timestamp => to_timestamp_tz('11/11/2021 14:10:00', 'mm/dd/yyyy hh24:mi:ss'));
Database DEVSNOW3CLONE2 successfully created.
-- Timestamp BEFORE example
CREATE DATABASE DEVSNOW3CLONE3 CLONE DEVSNOW3 AT (timestamp => to_timestamp_tz('11/11/2021 14:08:00', 'mm/dd/yyyy hh24:mi:ss'));
Database DEVSNOW3CLONE3 successfully created.
-- Timesstamp OFFSET of 60 seconds example
CREATE DATABASE DEVSNOW3CLONE4 CLONE DEVSNOW3 AT (offset => -60);
Database DEVSNOW3CLONE4 successfully created.
-- Statement ID example
CREATE DATABASE DEVSNOW3CLONE5 CLONE DEVSNOW3 AT (STATEMENT=>'01a0381a-0000-0ccf-0000-368900010516');
Database DEVSNOW3CLONE5 successfully created.
Example 8. Create database with Time Travel setting specified
USE ROLE SYSADMIN;
CREATE DATABASE DEVSNOW5 DATA_RETENTION_TIME_IN_DAYS=30;
Database DEVSNOW5 successfully created.
use role ACCOUNTADMIN;
GRANT OWNERSHIP ON DATABASE DEVSNOW3 TO ROLE SYSADMIN;
Statement executed successfully.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the ...
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.