OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.6.0

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.6.0
    iconOceanBase Database
    SQL - V 4.6.0
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    SERVICE_NAME

    Last Updated:2026-05-07 11:26:25  Updated
    Share
    What is on this page
    Purpose
    Limitations and considerations
    Privilege requirements
    Syntax
    Parameters
    Examples
    References

    folded

    Share

    Purpose

    The ALTER SYSTEM {CREATE | DELETE | START | STOP} SERVICE ... statement is used to maintain SERVICE_NAME (service name) and control operations such as the creation, deletion, start, and stop of SERVICE_NAME.

    Note

    To manage service names and perform primary-standby tenant switching via OCP, see Daily primary-standby tenant switching.

    Limitations and considerations

    • The META and SYS tenants do not support the SERVICE_NAME feature.
    • OceanBase Cloud Platform (OCP) ensures that within its managed clusters, only one primary tenant can exist under a single SERVICE_NAME. Users must ensure this when setting SERVICE_NAME through the CLI.
    • The FAILOVER operation automatically deletes all SERVICE_NAME entries under the tenant.
    • A tenant can have at most one SERVICE_NAME.
    • Connections established through SERVICE_NAME cannot execute maintenance commands related to SERVICE_NAME or tenant primary-standby role conversion. Otherwise, an OB_OP_NOT_ALLOW error will be returned.

    Privilege requirements

    The user executing this statement must have the ALTER SYSTEM privilege. For more information about OceanBase Database privileges, see Privilege classification in MySQL mode and Privilege classification in Oracle mode.

    Syntax

    ALTER SYSTEM {CREATE | DELETE | START | STOP} SERVICE service_name [tenant = 'tenant_name'];
    

    Parameters

    Parameter
    Description
    CREATE Creates a service. After the service is created, it is automatically started.
    DELETE Deletes a service. Before deleting a service, it must be stopped.
    START Starts a service. After the service is started, you can establish a session or allow requests using this SERVICE_NAME.
    STOP Stops a service. After the service is stopped, no sessions can be established using this SERVICE_NAME, and no new sessions can be created.
    service_name Specifies the service name.
    tenant_name Optional. Specifies the tenant to operate on. If not specified, the current tenant is used as the default.

    Notice

    The SERVICE_NAME feature is not supported for the system tenant. When executing this statement in the system tenant, you must specify the TENANT = tenant_name clause.

    Examples

    Create a service named service_mysql001 for the tenant mysql001.

    ALTER SYSTEM CREATE SERVICE service_mysql001 TENANT = 'mysql001';
    

    References

    • To query the SERVICE_NAME and its status of a tenant, see DBA_OB_SERVICES or oceanbase.CDB_OB_SERVICES.

    • To query the execution status of maintenance commands related to SERVICE_NAME, see DBA_OB_TENANT_EVENT_HISTORY or oceanbase.CDB_OB_TENANT_EVENT_HISTORY.

    • For more information about SERVICE_NAME maintenance commands, see Create a service.

    • For more information about connecting to a tenant using SERVICE_NAME, see Connect to an OceanBase tenant by using OBClient (MySQL mode) or Connect to an OceanBase tenant by using OBClient (Oracle mode).

    Previous topic

    SERVER
    Last

    Next topic

    SWITCHOVER
    Next
    What is on this page
    Purpose
    Limitations and considerations
    Privilege requirements
    Syntax
    Parameters
    Examples
    References