You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/07/25 18:40:25 UTC

[GitHub] [shardingsphere] chakkk309 opened a new pull request, #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

chakkk309 opened a new pull request, #19537:
URL: https://github.com/apache/shardingsphere/pull/19537

   Ref https://github.com/apache/shardingsphere/issues/6480 & https://github.com/apache/shardingsphere/issues/18389
   
   - Add  `ALTER PLUGGABLE DATABASE`  grammar
   - Support parsing  `ALTER PLUGGABLE DATABASE`  in Oracle
   - Add test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu merged pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
strongduanmu merged PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] chakkk309 commented on a diff in pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
chakkk309 commented on code in PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#discussion_r931362560


##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -3214,3 +3214,193 @@ forRefreshClause
     : FOR ((SYNCHRONOUS REFRESH USING stagingLogName) | (FAST REFRESH))
     ;
 
+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? pdbSettingCluase
+    | CONTAINERS containersClause
+    ;
+
+pdbSettingCluase
+    : 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?

Review Comment:
   Update: I found the usage of **pdb_refresh_switchover_clause** in ALTER PLUGGABLE DATABASE in the official documentation, so we should keep this SQL syntax.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] chakkk309 commented on a diff in pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
chakkk309 commented on code in PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#discussion_r929227069


##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -3214,3 +3214,193 @@ forRefreshClause
     : FOR ((SYNCHRONOUS REFRESH USING stagingLogName) | (FAST REFRESH))
     ;
 
+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? pdbSettingCluase
+    | CONTAINERS containersClause
+    ;
+
+pdbSettingCluase
+    : 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
+    : ENABLE SNAPSHOT (MANUAL | (EVERY snapshotInterval (HOURS | MINUTES)) | NONE)

Review Comment:
   And in snapshotClauses, there also have differences: 
   - in graphic syntax diagrams:
   <img width="265" alt="image" src="https://user-images.githubusercontent.com/60494790/180858069-3deed5cf-96b9-4627-8754-08ff0eb0257a.png">
   
   - in the description of image, there is an additional `ENABLE` keyword:
   <img width="488" alt="38acb62dff94d19d531e2f635fe450a" src="https://user-images.githubusercontent.com/60494790/180858156-c4e4ca89-a6b0-4ffc-aaae-a055601d23e3.png">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] chakkk309 commented on a diff in pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
chakkk309 commented on code in PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#discussion_r929215766


##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -3214,3 +3214,193 @@ forRefreshClause
     : FOR ((SYNCHRONOUS REFRESH USING stagingLogName) | (FAST REFRESH))
     ;
 
+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? pdbSettingCluase
+    | CONTAINERS containersClause
+    ;
+
+pdbSettingCluase
+    : 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?

Review Comment:
   According to Oracle's official documentation for [ALTER PLUGGABLE DATABASE](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ALTER-PLUGGABLE-DATABASE.html#GUID-A29491AD-8F0F-4E52-9D94-57FC3FF8FBC7), it is found that there are some differences between BNF syntax and .eps syntax for **pdb_settings_clauses** SQL.
   - in graphic syntax diagrams:
   <img width="395" alt="524f22a107e9c78b9a3b2d49b8d51d0" src="https://user-images.githubusercontent.com/60494790/180854098-a48be7ba-4b1b-4be7-b708-839ac9cc18a8.png">
   
   - in the description of image syntax,  there is an optional clause after the refresh keyword : 
   
   <img width="515" alt="a47ae24adfee4b8ac5e8af4b3452a12" src="https://user-images.githubusercontent.com/60494790/180854267-ec43e095-39b2-4b88-90c5-71eabed1b504.png">
   I would like to know which kind of syntax should I follow?
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] chakkk309 commented on a diff in pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
chakkk309 commented on code in PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#discussion_r931776517


##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -3214,3 +3214,193 @@ forRefreshClause
     : FOR ((SYNCHRONOUS REFRESH USING stagingLogName) | (FAST REFRESH))
     ;
 
+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? pdbSettingCluase
+    | CONTAINERS containersClause
+    ;
+
+pdbSettingCluase
+    : 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
+    : ENABLE SNAPSHOT (MANUAL | (EVERY snapshotInterval (HOURS | MINUTES)) | NONE)

Review Comment:
   According to the SQL execution result, we should remove the `ENABLE` keyword.
   
   <img width="389" alt="5e87aeebbc0b2261b26d42b17526f85" src="https://user-images.githubusercontent.com/60494790/181415381-cbfdd454-0a08-4ad3-891b-1a60c6e84808.png">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] codecov-commenter commented on pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#issuecomment-1197678565

   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/19537?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19537](https://codecov.io/gh/apache/shardingsphere/pull/19537?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3e8c6e0) into [master](https://codecov.io/gh/apache/shardingsphere/commit/57c9ba82889b9f5ae23f14cfe38a0d56a964f7fe?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (57c9ba8) will **increase** coverage by `0.00%`.
   > The diff coverage is `80.00%`.
   
   ```diff
   @@            Coverage Diff            @@
   ##             master   #19537   +/-   ##
   =========================================
     Coverage     60.20%   60.20%           
   - Complexity     2397     2398    +1     
   =========================================
     Files          3840     3842    +2     
     Lines         54677    54682    +5     
     Branches       7645     7645           
   =========================================
   + Hits          32917    32921    +4     
   - Misses        18928    18929    +1     
     Partials       2832     2832           
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/19537?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...cle/ddl/OracleAlterPluggableDatabaseStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/19537/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9zdGF0ZW1lbnQvb3JhY2xlL2RkbC9PcmFjbGVBbHRlclBsdWdnYWJsZURhdGFiYXNlU3RhdGVtZW50LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...r/statement/impl/OracleDDLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/19537/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1vcmFjbGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvb3JhY2xlL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvT3JhY2xlRERMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `88.37% <100.00%> (+0.03%)` | :arrow_up: |
   | [...l/parser/core/database/visitor/SQLVisitorRule.java](https://codecov.io/gh/apache/shardingsphere/pull/19537/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWVuZ2luZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9jb3JlL2RhdGFiYXNlL3Zpc2l0b3IvU1FMVmlzaXRvclJ1bGUuamF2YQ==) | `100.00% <100.00%> (ø)` | |
   | [...eterized/jaxb/cases/domain/SQLParserTestCases.java](https://codecov.io/gh/apache/shardingsphere/pull/19537/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vU1FMUGFyc2VyVGVzdENhc2VzLmphdmE=) | `99.29% <100.00%> (+<0.01%)` | :arrow_up: |
   | [...t/ddl/AlterPluggableDatabaseStatementTestCase.java](https://codecov.io/gh/apache/shardingsphere/pull/19537/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vc3RhdGVtZW50L2RkbC9BbHRlclBsdWdnYWJsZURhdGFiYXNlU3RhdGVtZW50VGVzdENhc2UuamF2YQ==) | `100.00% <100.00%> (ø)` | |
   
   Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#discussion_r931684333


##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -3214,3 +3214,193 @@ forRefreshClause
     : FOR ((SYNCHRONOUS REFRESH USING stagingLogName) | (FAST REFRESH))
     ;
 
+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? pdbSettingCluase
+    | CONTAINERS containersClause
+    ;
+
+pdbSettingCluase
+    : 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?

Review Comment:
   > Update: I found the usage of **pdb_refresh_switchover_clause** in ALTER PLUGGABLE DATABASE in the official documentation, so we should keep this SQL syntax.
   
   That's great. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] chakkk309 commented on a diff in pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
chakkk309 commented on code in PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#discussion_r929215766


##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -3214,3 +3214,193 @@ forRefreshClause
     : FOR ((SYNCHRONOUS REFRESH USING stagingLogName) | (FAST REFRESH))
     ;
 
+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? pdbSettingCluase
+    | CONTAINERS containersClause
+    ;
+
+pdbSettingCluase
+    : 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?

Review Comment:
   According to Oracle's official documentation for [ALTER PLUGGABLE DATABASE](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ALTER-PLUGGABLE-DATABASE.html#GUID-A29491AD-8F0F-4E52-9D94-57FC3FF8FBC7), it is found that there are some differences between BNF syntax and .eps syntax for **pdb_settings_clauses**.
   - in BNF syntax:
   <img width="395" alt="524f22a107e9c78b9a3b2d49b8d51d0" src="https://user-images.githubusercontent.com/60494790/180854098-a48be7ba-4b1b-4be7-b708-839ac9cc18a8.png">
   
   - in .eps syntax,  there is an optional clause after the refresh keyword : 
   
   <img width="515" alt="a47ae24adfee4b8ac5e8af4b3452a12" src="https://user-images.githubusercontent.com/60494790/180854267-ec43e095-39b2-4b88-90c5-71eabed1b504.png">
   I would like to know which kind of syntax should I follow?
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] chakkk309 commented on a diff in pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
chakkk309 commented on code in PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#discussion_r929215766


##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -3214,3 +3214,193 @@ forRefreshClause
     : FOR ((SYNCHRONOUS REFRESH USING stagingLogName) | (FAST REFRESH))
     ;
 
+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? pdbSettingCluase
+    | CONTAINERS containersClause
+    ;
+
+pdbSettingCluase
+    : 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?

Review Comment:
   According to Oracle's official documentation for [ALTER PLUGGABLE DATABASE](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ALTER-PLUGGABLE-DATABASE.html#GUID-A29491AD-8F0F-4E52-9D94-57FC3FF8FBC7), it is found that there are some differences between BNF syntax and .eps syntax for **pdb_settings_clauses** SQL.
   - in BNF syntax:
   <img width="395" alt="524f22a107e9c78b9a3b2d49b8d51d0" src="https://user-images.githubusercontent.com/60494790/180854098-a48be7ba-4b1b-4be7-b708-839ac9cc18a8.png">
   
   - in .eps syntax,  there is an optional clause after the refresh keyword : 
   
   <img width="515" alt="a47ae24adfee4b8ac5e8af4b3452a12" src="https://user-images.githubusercontent.com/60494790/180854267-ec43e095-39b2-4b88-90c5-71eabed1b504.png">
   I would like to know which kind of syntax should I follow?
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] chakkk309 commented on a diff in pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
chakkk309 commented on code in PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#discussion_r929504021


##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -3214,3 +3214,193 @@ forRefreshClause
     : FOR ((SYNCHRONOUS REFRESH USING stagingLogName) | (FAST REFRESH))
     ;
 
+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? pdbSettingCluase
+    | CONTAINERS containersClause
+    ;
+
+pdbSettingCluase
+    : 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
+    : ENABLE SNAPSHOT (MANUAL | (EVERY snapshotInterval (HOURS | MINUTES)) | NONE)

Review Comment:
   Thanks, I will check these in Oracle.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] chakkk309 commented on pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
chakkk309 commented on PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#issuecomment-1197655021

   > Can you solve code conflict first?
   
   Sure, solved it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] chakkk309 commented on a diff in pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
chakkk309 commented on code in PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#discussion_r929215766


##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -3214,3 +3214,193 @@ forRefreshClause
     : FOR ((SYNCHRONOUS REFRESH USING stagingLogName) | (FAST REFRESH))
     ;
 
+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? pdbSettingCluase
+    | CONTAINERS containersClause
+    ;
+
+pdbSettingCluase
+    : 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?

Review Comment:
   According to Oracle's official documentation for [ALTER PLUGGABLE DATABASE](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ALTER-PLUGGABLE-DATABASE.html#GUID-A29491AD-8F0F-4E52-9D94-57FC3FF8FBC7), it is found that there are some differences between BNF syntax and .eps syntax for **pdb_settings_clauses** SQL.
   - in graphic syntax diagrams:
   <img width="395" alt="524f22a107e9c78b9a3b2d49b8d51d0" src="https://user-images.githubusercontent.com/60494790/180854098-a48be7ba-4b1b-4be7-b708-839ac9cc18a8.png">
   
   - in the description of image syntax,  there is an optional clause after the refresh keyword : 
   
   <img width="515" alt="a47ae24adfee4b8ac5e8af4b3452a12" src="https://user-images.githubusercontent.com/60494790/180854267-ec43e095-39b2-4b88-90c5-71eabed1b504.png">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #19537: Support parsing `ALTER PLUGGABLE DATABASE` in Oracle

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #19537:
URL: https://github.com/apache/shardingsphere/pull/19537#discussion_r929422842


##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -3214,3 +3214,193 @@ forRefreshClause
     : FOR ((SYNCHRONOUS REFRESH USING stagingLogName) | (FAST REFRESH))
     ;
 
+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? pdbSettingCluase
+    | CONTAINERS containersClause
+    ;
+
+pdbSettingCluase
+    : 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
+    : ENABLE SNAPSHOT (MANUAL | (EVERY snapshotInterval (HOURS | MINUTES)) | NONE)

Review Comment:
   I think you can execute these sqls in Oracle database.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org