This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 972b4c9984e Support parsing `ALTER PLUGGABLE DATABASE` in Oracle
(#19537)
972b4c9984e is described below
commit 972b4c9984e8c6df606b8924401b6aa415908157
Author: Jiaqi Yan <[email protected]>
AuthorDate: Thu Jul 28 13:56:55 2022 +0800
Support parsing `ALTER PLUGGABLE DATABASE` in Oracle (#19537)
* Support parsing ALTER PLUGGABLE DATABASE in Oracle
* fix typo
* update syntax
* format code
---
.../src/main/antlr4/imports/oracle/BaseRule.g4 | 63 ++++++-
.../src/main/antlr4/imports/oracle/DDLStatement.g4 | 190 +++++++++++++++++++++
.../main/antlr4/imports/oracle/OracleKeyword.g4 | 76 +++++++++
.../sql/parser/autogen/OracleStatement.g4 | 1 +
.../impl/OracleDDLStatementSQLVisitor.java | 7 +
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../ddl/OracleAlterPluggableDatabaseStatement.java | 29 ++++
.../jaxb/cases/domain/SQLParserTestCases.java | 4 +
.../AlterPluggableDatabaseStatementTestCase.java | 26 +++
.../case/ddl/alter-pluggable-database.xml | 30 ++++
.../sql/supported/ddl/alter-pluggable-database.xml | 30 ++++
11 files changed, 457 insertions(+), 1 deletion(-)
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/BaseRule.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/BaseRule.g4
index 2cfdbb26cba..2c69d13c430 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/BaseRule.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/BaseRule.g4
@@ -97,7 +97,7 @@ unreservedWord
| SYSGUID | SYSBACKUP | SYSDBA | SYSDG | SYSKM | SYSOPER | DBA_RECYCLEBIN
|SCHEMA
| DO | DEFINER | CURRENT_USER | CASCADED | CLOSE | OPEN | NEXT | NAME |
NAMES
| COLLATION | REAL | TYPE | FIRST | RANK | SAMPLE | SYSTIMESTAMP |
INTERVAL | MINUTE | ANY
- | LENGTH | SINGLE_C | capacityUnit | TARGET | PUBLIC | ID
+ | LENGTH | SINGLE_C | capacityUnit | TARGET | PUBLIC | ID | STATE
;
schemaName
@@ -1470,3 +1470,64 @@ sqlStatement
: STRING_
;
+
+transportSecret
+ : STRING_
+ ;
+
+hostName
+ : STRING_
+ ;
+
+mapObject
+ : STRING_
+ ;
+
+refreshInterval
+ : INTEGER_
+ ;
+
+sourcePdbName
+ : STRING_
+ ;
+
+appName
+ : STRING_
+ ;
+
+commentValue
+ : STRING_
+ ;
+
+appVersion
+ : NUMBER_
+ ;
+
+startAppVersion
+ : NUMBER_
+ ;
+
+endAppVersion
+ : NUMBER_
+ ;
+
+patchNumber
+ : INTEGER_
+ ;
+
+snapshotInterval
+ : INTEGER_
+ ;
+
+snapshotName
+ : STRING_
+ ;
+
+maxPdbSnapshots
+ : INTEGER_
+ ;
+
+maxNumberOfSnapshots
+ : INTEGER_
+ ;
+
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
index fed3f96768c..48b7daa482a 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
@@ -3288,3 +3288,193 @@ optionValues
| MAXVALUE EQ_ optionValue
;
+alterPluggableDatabase
+ : ALTER databaseClause (pdbUnplugClause
+ | pdbSettingsClauses
+ | pdbDatafileClause
+ | pdbRecoveryClauses
+ | pdbChangeState
+ | pdbChangeStateFromRoot
+ | applicationClauses
+ | snapshotClauses
+ | prepareClause
+ | dropMirrorCopy
+ | lostWriteProtection)
+ ;
+
+databaseClause
+ : DATABASE dbName?
+ | PLUGGABLE DATABASE pdbName?
+ ;
+
+pdbUnplugClause
+ : pdbName UNPLUG INTO fileName pdbUnplugEncrypt?
+ ;
+
+pdbUnplugEncrypt
+ : ENCRYPT USING transportSecret
+ ;
+
+pdbSettingsClauses
+ : pdbName? pdbSettingClause
+ | CONTAINERS containersClause
+ ;
+
+pdbSettingClause
+ : DEFAULT EDITION EQ_ editionName
+ | SET DEFAULT (BIGFILE | SMALLFILE) TABLESPACE
+ | DEFAULT TABLESPACE tablespaceName
+ | DEFAULT TEMPORARY TABLESPACE (tablespaceName | tablespaceGroupName)
+ | RENAME GLOBAL_NAME TO databaseName (DOT_ domain)+
+ | setTimeZoneClause
+ | databaseFileClauses
+ | supplementalDbLogging
+ | pdbStorageClause
+ | pdbLoggingClauses
+ | pdbRefreshModeClause
+ | REFRESH pdbRefreshSwitchoverClause?
+ | SET CONTAINER_MAP EQ_ mapObject
+ ;
+
+containersClause
+ : DEFAULT TARGET EQ_ ((LP_ containerName RP_) | NONE)
+ | HOST EQ_ hostName
+ | PORT EQ_ NUMBER_
+ ;
+
+pdbStorageClause
+ : STORAGE ((LP_ storageMaxSizeClauses+ RP_) | UNLIMITED)
+ ;
+
+storageMaxSizeClauses
+ : (MAXSIZE | MAX_AUDIT_SIZE | MAX_DIAG_SIZE) (UNLIMITED | sizeClause)
+ ;
+
+pdbLoggingClauses
+ : loggingClause | pdbForceLoggingClause
+ ;
+
+pdbForceLoggingClause
+ : (ENABLE | DISABLE) FORCE (LOGGING | NOLOGGING)
+ | SET STANDBY NOLOGGING FOR ((DATA AVAILABILITY) | (LOAD PERFORMANCE))
+ ;
+
+pdbRefreshModeClause
+ : REFRESH MODE (MANUAL | (EVERY refreshInterval (MINUTES | HOURS)) | NONE )
+ ;
+
+pdbRefreshSwitchoverClause
+ : FROM sourcePdbName AT_ dbLink SWITCHOVER
+ ;
+
+pdbDatafileClause
+ : pdbName? DATAFILE (fileNameAndNumber | ALL) (ONLINE | OFFLINE)
+ ;
+
+fileNameAndNumber
+ : (fileName | fileNumber) (COMMA_ (fileName | fileNumber))*
+ ;
+
+pdbRecoveryClauses
+ : pdbName? (pdbGeneralRecovery
+ | BEGIN BACKUP
+ | END BACKUP
+ | ENABLE RECOVERY
+ | DISABLE RECOVERY)
+ ;
+
+pdbGeneralRecovery
+ : RECOVER AUTOMATIC? (FROM locationName)? (DATABASE
+ | TABLESPACE tablespaceName (COMMA_ tablespaceName)*
+ | DATAFILE fileNameAndNumber
+ | LOGFILE fileName
+ | CONTINUE DEFAULT?)?
+ ;
+
+pdbChangeState
+ : pdbName? (pdbOpen | pdbClose | pdbSaveOrDiscardState)
+ ;
+
+pdbOpen
+ : OPEN (((READ WRITE) | (READ ONLY))? RESTRICTED? FORCE?
+ | (READ WRITE)? UPGRADE RESTRICTED?
+ | RESETLOGS) instancesClause?
+ ;
+
+instancesClause
+ : INSTANCES EQ_ (instanceNameClause | (ALL (EXCEPT instanceName)?))
+ ;
+
+instanceNameClause
+ : LP_ instanceName (COMMA_ instanceName )* RP_
+ ;
+
+pdbClose
+ : CLOSE ((IMMEDIATE? (instancesClause | relocateClause)?) | (ABORT?
instancesClause?))
+ ;
+
+relocateClause
+ : RELOCATE (TO instanceName)?
+ | NORELOCATE
+ ;
+
+pdbSaveOrDiscardState
+ : (SAVE | DISCARD) STATE instancesClause?
+ ;
+
+pdbChangeStateFromRoot
+ : (pdbNameClause | (ALL (EXCEPT pdbNameClause)?)) (pdbOpen | pdbClose |
pdbSaveOrDiscardState)
+ ;
+
+pdbNameClause
+ : pdbName (COMMA_ pdbName)*
+ ;
+
+applicationClauses
+ : APPLICATION ((appName appClause) | (ALL SYNC))
+ ;
+
+appClause
+ : BEGIN INSTALL SQ_ appVersion SQ_ (COMMENT SQ_ commentValue SQ_)?
+ | END INSTALL (SQ_ appVersion SQ_)?
+ | BEGIN PATCH NUMBER_ (MINIMUM VERSION SQ_ appVersion SQ_)? (COMMENT SQ_
commentValue SQ_)?
+ | END PATCH NUMBER_?
+ | BEGIN UPGRADE (SQ_ startAppVersion SQ_)? TO SQ_ endAppVersion SQ_
(COMMENT SQ_ commentValue SQ_)?
+ | END UPGRADE (TO SQ_ endAppVersion SQ_)?
+ | BEGIN UNINSTALL
+ | END UNINSTALL
+ | SET PATCH NUMBER_
+ | SET VERSION SQ_ appVersion SQ_
+ | SET COMPATIBILITY VERSION ((SQ_ appVersion SQ_) | CURRENT)
+ | SYNC TO ((SQ_ appVersion SQ_) | (PATCH patchNumber))
+ | SYNC
+ ;
+
+snapshotClauses
+ : pdbSnapshotClause
+ | materializeClause
+ | createSnapshotClause
+ | dropSnapshotClause
+ | setMaxPdbSnapshotsClause
+ ;
+
+pdbSnapshotClause
+ : SNAPSHOT (MANUAL | (EVERY snapshotInterval (HOURS | MINUTES)) | NONE)
+ ;
+
+materializeClause
+ : MATERIALIZE
+ ;
+
+createSnapshotClause
+ : SNAPSHOT snapshotName
+ ;
+
+dropSnapshotClause
+ : DROP SNAPSHOT snapshotName
+ ;
+
+setMaxPdbSnapshotsClause
+ : SET maxPdbSnapshots EQ_ maxNumberOfSnapshots
+ ;
+
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/OracleKeyword.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/OracleKeyword.g4
index 1ff712e7d20..a54e1930e72 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/OracleKeyword.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/OracleKeyword.g4
@@ -1111,6 +1111,14 @@ MAXSIZE
: M A X S I Z E
;
+MAX_AUDIT_SIZE
+ : M A X UL_ A U D I T UL_ S I Z E
+ ;
+
+MAX_DIAG_SIZE
+ : M A X UL_ D I A G UL_ S I Z E
+ ;
+
STORE
: S T O R E
;
@@ -2959,3 +2967,71 @@ CLAUSE
: C L A U S E
;
+
+UNPLUG
+ : U N P L U G
+ ;
+
+HOST
+ : H O S T
+ ;
+
+PORT
+ : P O R T
+ ;
+
+EVERY
+ : E V E R Y
+ ;
+
+MINUTES
+ : M I N U T E S
+ ;
+
+HOURS
+ : H O U R S
+ ;
+
+NORELOCATE
+ : N O R E L O C A T E
+ ;
+
+SAVE
+ : S A V E
+ ;
+
+DISCARD
+ : D I S C A R D
+ ;
+
+STATE
+ : S T A T E
+ ;
+
+APPLICATION
+ : A P P L I C A T I O N
+ ;
+
+INSTALL
+ : I N S T A L L
+ ;
+
+MINIMUM
+ : M I N I M U M
+ ;
+
+VERSION
+ : V E R S I O N
+ ;
+
+UNINSTALL
+ : U N I N S T A L L
+ ;
+
+COMPATIBILITY
+ : C O M P A T I B I L I T Y
+ ;
+
+MATERIALIZE
+ : M A T E R I A L I Z E
+ ;
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OracleStatement.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OracleStatement.g4
index 7751bc04258..1fdc2a528f1 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OracleStatement.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OracleStatement.g4
@@ -121,5 +121,6 @@ execute
| alterFunction
| alterHierarchy
| alterLockdownProfile
+ | alterPluggableDatabase
) SEMI_?
;
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleDDLStatementSQLVisitor.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleDDLStatementSQLVisitor.java
index d0624195853..652c08bb309 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleDDLStatementSQLVisitor.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleDDLStatementSQLVisitor.java
@@ -48,6 +48,7 @@ import
org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterO
import
org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterOutlineContext;
import
org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterPackageContext;
import
org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterLockdownProfileContext;
+import
org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterPluggableDatabaseContext;
import
org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterSequenceContext;
import
org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterSessionContext;
import
org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterSynonymContext;
@@ -171,6 +172,7 @@ import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.Ora
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterOperatorStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterOutlineStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterPackageStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterPluggableDatabaseStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterSequenceStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterSessionStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterSynonymStatement;
@@ -969,4 +971,9 @@ public final class OracleDDLStatementSQLVisitor extends
OracleStatementSQLVisito
public ASTNode visitAlterLockdownProfile(final AlterLockdownProfileContext
ctx) {
return new OracleAlterLockdownProfileStatement();
}
+
+ @Override
+ public ASTNode visitAlterPluggableDatabase(final
AlterPluggableDatabaseContext ctx) {
+ return new OracleAlterPluggableDatabaseStatement();
+ }
}
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
index ea8a92fe406..72569bd18a3 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
@@ -74,6 +74,8 @@ public enum SQLVisitorRule {
ALTER_MATERIALIZED_VIEW_LOG("AlterMaterializedViewLog",
SQLStatementType.DDL),
+ ALTER_PLUGGABLE_DATABASE("AlterPluggableDatabase", SQLStatementType.DDL),
+
ALTER_OPERATOR("AlterOperator", SQLStatementType.DDL),
DROP_TABLE("DropTable", SQLStatementType.DDL),
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleAlterPluggableDatabaseStatement.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleAlterPluggableDatabaseStatement.java
new file mode 100644
index 00000000000..804f697f79f
--- /dev/null
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleAlterPluggableDatabaseStatement.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl;
+
+import lombok.ToString;
+import
org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.OracleStatement;
+
+/**
+ * Oracle alter pluggable database statement.
+ */
+@ToString(callSuper = true)
+public final class OracleAlterPluggableDatabaseStatement extends
AbstractSQLStatement implements OracleStatement {
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index 4ad8513e72a..e8c1ba95e2d 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -127,6 +127,7 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterOperatorStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterOutlineStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterPackageStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterPluggableDatabaseStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterPolicyStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterProcedureStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterPublicationStatementTestCase;
@@ -1356,6 +1357,9 @@ public final class SQLParserTestCases {
@XmlElement(name = "alter-materialized-view-log")
private final List<AlterMaterializedViewLogStatementTestCase>
alterMaterializedViewLogTestCases = new LinkedList<>();
+ @XmlElement(name = "alter-pluggable-database")
+ private final List<AlterPluggableDatabaseStatementTestCase>
alterPluggableDatabaseTestCases = new LinkedList<>();
+
@XmlElement(name = "alter-java")
private final List<AlterJavaStatementTestCase> alterJavaTestCases = new
LinkedList<>();
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/AlterPluggableDatabaseStatementTestCase.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/AlterPluggableDatabaseStatementTestCase.java
new file mode 100644
index 00000000000..74c923391f2
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/AlterPluggableDatabaseStatementTestCase.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl;
+
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+
+/**
+ * Alter pluggable database statement test case.
+ */
+public final class AlterPluggableDatabaseStatementTestCase extends
SQLParserTestCase {
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-pluggable-database.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-pluggable-database.xml
new file mode 100644
index 00000000000..c5acb0d0f1d
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-pluggable-database.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<sql-parser-test-cases>
+ <alter-pluggable-database sql-case-id="alter_pluggable_database_unplug" />
+ <alter-pluggable-database sql-case-id="alter_pluggable_database_storage" />
+ <alter-pluggable-database
sql-case-id="alter_pluggable_database_datafile_all_offline" />
+ <alter-pluggable-database
sql-case-id="alter_pluggable_database_open_read_only" />
+ <alter-pluggable-database
sql-case-id="alter_pluggable_database_open_read_write_force" />
+ <alter-pluggable-database sql-case-id="alter_pluggable_database_close" />
+ <alter-pluggable-database
sql-case-id="alter_pluggable_database_open_read_only_restricted" />
+ <alter-pluggable-database
sql-case-id="alter_pluggable_database_open_read_only_instance" />
+ <alter-pluggable-database
sql-case-id="alter_pluggable_database_close_relocate_to" />
+ <alter-pluggable-database
sql-case-id="alter_pluggable_database_all_open_read_only" />
+</sql-parser-test-cases>
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-pluggable-database.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-pluggable-database.xml
new file mode 100644
index 00000000000..1ec0ff1a812
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-pluggable-database.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<sql-cases>
+ <sql-case id="alter_pluggable_database_unplug" value="ALTER PLUGGABLE
DATABASE pdb1 UNPLUG INTO '/oracle/data/pdb1.xml';" db-types="Oracle"/>
+ <sql-case id="alter_pluggable_database_storage" value="ALTER PLUGGABLE
DATABASE pdb2 STORAGE (MAXSIZE 500M);" db-types="Oracle"/>
+ <sql-case id="alter_pluggable_database_datafile_all_offline" value="ALTER
PLUGGABLE DATABASE pdb3 DATAFILE ALL OFFLINE;" db-types="Oracle"/>
+ <sql-case id="alter_pluggable_database_open_read_only" value="ALTER
PLUGGABLE DATABASE pdb4 OPEN READ ONLY;" db-types="Oracle"/>
+ <sql-case id="alter_pluggable_database_open_read_write_force" value="ALTER
PLUGGABLE DATABASE pdb4 OPEN READ WRITE FORCE;" db-types="Oracle"/>
+ <sql-case id="alter_pluggable_database_close" value="ALTER PLUGGABLE
DATABASE pdb4 CLOSE;" db-types="Oracle"/>
+ <sql-case id="alter_pluggable_database_open_read_only_restricted"
value="ALTER PLUGGABLE DATABASE pdb4 OPEN READ ONLY RESTRICTED;"
db-types="Oracle"/>
+ <sql-case id="alter_pluggable_database_open_read_only_instance"
value="ALTER PLUGGABLE DATABASE pdb5 OPEN READ WRITE INSTANCES = ('ORCLDB_1',
'ORCLDB_2');" db-types="Oracle"/>
+ <sql-case id="alter_pluggable_database_close_relocate_to" value="ALTER
PLUGGABLE DATABASE pdb6 CLOSE RELOCATE TO 'ORCLDB_3';" db-types="Oracle"/>
+ <sql-case id="alter_pluggable_database_all_open_read_only" value="ALTER
PLUGGABLE DATABASE ALL OPEN READ ONLY;" db-types="Oracle"/>
+</sql-cases>