-- ============================================================
-- HMM ADB -> AWS RDS PostgreSQL federation demo
-- Step 0: precheck
-- Run in Database Actions SQL Worksheet as ADMIN.
-- Redmine: #730
-- ============================================================

SELECT
  USER AS session_user,
  SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') AS current_schema,
  SYS_CONTEXT('USERENV', 'DB_NAME') AS database_name
FROM dual;

SELECT credential_name, username
FROM all_credentials
WHERE credential_name = 'HMM_RDS_PG_CRED';

SELECT db_link, username, host, created
FROM user_db_links
WHERE db_link = 'HMM_RDS_PG_LINK';

SELECT object_name, object_type, status
FROM user_objects
WHERE object_name IN (
  'HMM_RDS_CARRIERS_V',
  'HMM_RDS_CARRIER_PERF_V',
  'HMM_RDS_CARRIER_LATEST_V'
)
ORDER BY object_name;

-- First recording: the last three queries should return no rows.
-- If objects already exist, run 80_hmm_rds_pg_99_cleanup.sql first.
