Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Deleting Resources

Updated on 2022-07-29 GMT+08:00

After completing operations in this tutorial, if you no longer need to use the resources created during the operations, you can delete them to avoid resource waste or quota occupation. The procedure is as follows:

  1. Deleting the Foreign Table and Target Table
  2. Deleting the Created Foreign Server
  3. Deleting the Database and the User to Which the Database Belongs

    If you have performed steps in (Optional) Creating a User and a Database and Granting the User Foreign Table Permissions, delete the database and the user to which the database belongs.

Deleting the Foreign Table and Target Table

  1. (Optional) If you have performed steps in Querying Data After Importing It, run the following command to delete the target table:

    1
    DROP TABLE product_info;
    

    If the following information is displayed, the table has been deleted.

    DROP TABLE

  2. Run the following statement to delete the foreign table:

    1
    DROP FOREIGN TABLE product_info_ext_obs;
    

    If the following information is displayed, the table has been deleted.

    DROP FOREIGN TABLE

Deleting the Created Foreign Server

  1. Use the user who created the foreign server to connect to the database where the foreign server is located.

    In this example, common user dbuser is used to create the foreign server in mydatabase. You need to connect to the database through the database client tool provided by GaussDB(DWS). You can use the gsql client to log in to the database in either of the following ways:

    • If you have logged in to the gsql client, run the following command to switch the database and user:
      1
      \c mydatabase dbuser;
      

      Enter the password as prompted.

    • If you have logged in to the gsql client, you can run the \q command to exit gsql, and run the following command to reconnect to it:
      1
      gsql -d mydatabase -h 192.168.2.30 -U dbuser -p 8000 -r
      

      Enter the password as prompted.

  2. Delete the created foreign server.

    Run the following command to delete the server. For details about the syntax, see DROP SERVER.

    1
    DROP SERVER obs_server;
    

    The database is deleted if the following information is displayed:

    DROP SERVER

    View the foreign server.

    1
    SELECT * FROM pg_foreign_server WHERE srvname='obs_server';
    

    The server is successfully deleted if the returned result is as follows:

     srvname | srvowner | srvfdw | srvtype | srvversion | srvacl | srvoptions
    ---------+----------+--------+---------+------------+--------+------------
    (0 rows)

Deleting the Database and the User to Which the Database Belongs

If you have performed steps in (Optional) Creating a User and a Database and Granting the User Foreign Table Permissions, perform the following steps to delete the database and the user to which the database belongs.

  1. Delete the customized database.

    Connect to the default database gaussdb through the database client tool provided by GaussDB(DWS).

    If you have logged in to the database using the gsql client, run the following command to switch the database and user:

    Switch to the default database.

    \c gaussdb

    Enter your password as prompted.

    Run the following command to delete the customized database:

    1
    DROP DATABASE mydatabase;
    

    The database is deleted if the following information is displayed:

    DROP DATABASE

  2. Delete the common user created in this example as the administrator.

    Connect to the database as a database administrator through the database client tool provided by GaussDB(DWS).

    If you have logged in to the database using the gsql client, run the following command to switch the database and user:

    \c gaussdb dbadmin
    Run the following command to reclaim the permission for creating foreign servers:
    1
    REVOKE ALL ON FOREIGN DATA WRAPPER dfs_fdw FROM dbuser;
    

    The name of FOREIGN DATA WRAPPER must be dfs_fdw. dbuser is the username for creating SERVER.

    Run the following command to delete the user:

    1
    DROP USER dbuser;
    

    You can run the \du command to query for the user and check whether the user has been deleted.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback