You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/07/11 03:22:58 UTC
[shardingsphere] branch master updated: support alter audit policy in oracle (#18987)
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 54cbd3649fe support alter audit policy in oracle (#18987)
54cbd3649fe is described below
commit 54cbd3649fe681f32e7db5ba2e28ed9f73ac3d51
Author: Trydamere <30...@qq.com>
AuthorDate: Mon Jul 11 11:22:53 2022 +0800
support alter audit policy in oracle (#18987)
---
.../src/main/antlr4/imports/oracle/DDLStatement.g4 | 189 ++++++++++++++++++++-
.../sql/parser/autogen/OracleStatement.g4 | 1 +
.../impl/OracleDDLStatementSQLVisitor.java | 7 +
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../statement/ddl/AlterAuditPolicyStatement.java | 26 +++
.../ddl/OracleAlterAuditPolicyStatement.java | 29 ++++
.../jaxb/cases/domain/SQLParserTestCases.java | 5 +
.../ddl/AlterAuditPolicyStatementTestCase.java | 26 +++
.../main/resources/case/ddl/alter-audit-policy.xml | 23 +++
.../sql/supported/ddl/alter-audit-policy.xml | 23 +++
10 files changed, 330 insertions(+), 1 deletion(-)
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 c11ef5d0abf..8a0da9cc222 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
@@ -17,7 +17,7 @@
grammar DDLStatement;
-import BaseRule;
+import BaseRule, DCLStatement;
createTable
: CREATE createTableSpecification TABLE tableName createSharingClause createDefinitionClause createMemOptimizeClause createParentClause
@@ -2548,3 +2548,190 @@ resolveClauses
resolveClause
: LP_ matchString DOT_? (schemaName | MINUS_) RP_
;
+
+alterAuditPolicy
+ : ALTER AUDIT POLICY policyName
+ ((ADD | DROP) subAuditClause)?
+ (CONDITION (DROP | condition EVALUATE PER (STATEMENT | SESSION | INSTANCE)))?
+ ;
+
+subAuditClause
+ : (privilegeAuditClause)? (actionAuditClause)? (roleAuditClause)? (ONLY TOPLEVEL)?
+ ;
+
+privilegeAuditClause
+ : PRIVILEGES systemPrivilegeClause (COMMA_ systemPrivilegeClause)*
+ ;
+
+actionAuditClause
+ : (standardActions | componentActions)*
+ ;
+
+standardActions
+ : ACTIONS standardActionsClause standardActionsClause*
+ ;
+
+standardActionsClause
+ : (objectAction ON (DIRECTORY directoryName | MINING MODEL objectName | objectName) | systemAction)
+ ;
+
+objectAction
+ : ALL
+ | ALTER
+ | AUDIT
+ | COMMENT
+ | CREATE
+ | DELETE
+ | EXECUTE
+ | FLASHBACK
+ | GRANT
+ | INDEX
+ | INSERT
+ | LOCK
+ | READ
+ | RENAME
+ | SELECT
+ | UPDATE
+ | USE
+ | WRITE
+ ;
+
+systemAction
+ : ALL
+ | ALTER EDITION
+ | ALTER REWRITE EQUIVALENCE
+ | ALTER SUMMARY
+ | ALTER TRACING
+ | CREATE BITMAPFILE
+ | CREATE CONTROL FILE
+ | CREATE DATABASE
+ | CREATE SUMMARY
+ | DECLARE REWRITE EQUIVALENCE
+ | DROP BITMAPFILE
+ | DROP DATABASE
+ | DROP REWRITE EQUIVALENCE
+ | DROP SUMMARY
+ | FLASHBACK DATABASE
+ | MERGE
+ | SAVEPOINT
+ | SET CONSTRAINTS
+ | UNDROP OBJECT
+ | UPDATE INDEXES
+ | UPDATE JOIN INDEX
+ | VALIDATE INDEX
+ ;
+
+componentActions
+ : ACTIONS COMPONENT EQ_ (DATAPUMP | DIRECT_LOAD | OLS | XS) componentAction (COMMA_ componentAction)*
+ | DV componentAction ON objectName (COMMA_ componentAction ON objectName)*
+ ;
+
+componentAction
+ : ALL
+ | dataDumpAction
+ | directLoadAction
+ | labelSecurityAction
+ | securityAction
+ | databaseVaultAction
+ ;
+
+dataDumpAction
+ : EXPORT
+ | IMPORT
+ ;
+
+directLoadAction
+ : LOAD
+ ;
+
+labelSecurityAction
+ : CREATE POLICY
+ | ALTER POLICY
+ | DROP POLICY
+ | APPLY POLICY
+ | REMOVE POLICY
+ | SET AUTHORIZATION
+ | PRIVILEGED ACTION
+ | ENABLE POLICY
+ | DISABLE POLICY
+ | SUBSCRIBE OID
+ | UNSUBSCRIBE OID
+ | CREATE DATA LABEL
+ | ALTER DATA LABEL
+ | DROP DATA LABEL
+ | CREATE LABEL COMPONENT
+ | ALTER LABEL COMPONENTS
+ | DROP LABEL COMPONENTS
+ ;
+
+securityAction
+ : CREATE USER
+ | UPDATE USER
+ | DELETE USER
+ | CREATE ROLE
+ | UPDATE ROLE
+ | DELETE ROLE
+ | GRANT ROLE
+ | REVOKE ROLE
+ | ADD PROXY
+ | REMOVE PROXY
+ | SET USER PASSWORD
+ | SET USER VERIFIER
+ | CREATE ROLESET
+ | UPDATE ROLESET
+ | DELETE ROLESET
+ | CREATE SECURITY CLASS
+ | UPDATE SECURITY CLASS
+ | DELETE SECURITY CLASS
+ | CREATE NAMESPACE TEMPLATE
+ | UPDATE NAMESPACE TEMPLATE
+ | DELETE NAMESPACE TEMPLATE
+ | CREATE ACL
+ | UPDATE ACL
+ | DELETE ACL
+ | CREATE DATA SECURITY
+ | UPDATE DATA SECURITY
+ | DELETE DATA SECURITY
+ | ENABLE DATA SECURITY
+ | DISABLE DATA SECURITY
+ | ADD GLOBAL CALLBACK
+ | DELETE GLOBAL CALLBACK
+ | ENABLE GLOBAL CALLBACK
+ | ENABLE ROLE
+ | DISABLE ROLE
+ | SET COOKIE
+ | SET INACTIVE TIMEOUT
+ | CREATE SESSION
+ | DESTROY SESSION
+ | SWITCH USER
+ | ASSIGN USER
+ | CREATE SESSION NAMESPACE
+ | DELETE SESSION NAMESPACE
+ | CREATE NAMESPACE ATTRIBUTE
+ | GET NAMESPACE ATTRIBUTE
+ | SET NAMESPACE ATTRIBUTE
+ | DELETE NAMESPACE ATTRIBUTE
+ | SET USER PROFILE
+ | GRANT SYSTEM PRIVILEGE
+ | REVOKE SYSTEM PRIVILEGE
+ ;
+
+databaseVaultAction
+ : REALM VIOLATION
+ | REALM SUCCESS
+ | REALM ACCESS
+ | RULE SET FAILURE
+ | RULE SET SUCCESS
+ | RULE SET EVAL
+ | FACTOR ERROR
+ | FACTOR NULL
+ | FACTOR VALIDATE ERROR
+ | FACTOR VALIDATE FALSE
+ | FACTOR TRUST LEVEL NULL
+ | FACTOR TRUST LEVEL NEG
+ | FACTOR ALL
+ ;
+
+roleAuditClause
+ : ROLES roleName (COMMA_ roleName)*
+ ;
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 1fac0f4a114..dfe73c94697 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
@@ -111,5 +111,6 @@ execute
| alterLibrary
| alterMaterializedZonemap
| alterJava
+ | alterAuditPolicy
) 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 056ec1baef1..909797160d7 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
@@ -25,6 +25,7 @@ import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AddCol
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AddConstraintSpecificationContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterAnalyticViewContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterAttributeDimensionContext;
+import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterAuditPolicyContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterDatabaseContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterDatabaseDictionaryContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AlterDatabaseLinkContext;
@@ -139,6 +140,7 @@ import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.Sim
import org.apache.shardingsphere.sql.parser.sql.common.value.collection.CollectionValue;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterAnalyticViewStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterAttributeDimensionStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterAuditPolicyStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterDatabaseDictionaryStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterDatabaseLinkStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterDatabaseStatement;
@@ -899,4 +901,9 @@ public final class OracleDDLStatementSQLVisitor extends OracleStatementSQLVisito
public ASTNode visitAlterJava(final AlterJavaContext ctx) {
return new OracleAlterJavaStatement();
}
+
+ @Override
+ public ASTNode visitAlterAuditPolicy(final AlterAuditPolicyContext ctx) {
+ return new OracleAlterAuditPolicyStatement();
+ }
}
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 5cd65928b5e..5f3e06068dc 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
@@ -584,6 +584,8 @@ public enum SQLVisitorRule {
ALTER_JAVA("AlterJava", SQLStatementType.DDL),
+ ALTER_AUDIT_POLICY("AlterAuditPolicy", SQLStatementType.DDL),
+
CURSOR("Cursor", SQLStatementType.DDL),
CLOSE("Close", SQLStatementType.DDL),
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/AlterAuditPolicyStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/AlterAuditPolicyStatement.java
new file mode 100644
index 00000000000..d2c6f810429
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/AlterAuditPolicyStatement.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.sql.parser.sql.common.statement.ddl;
+
+import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+
+/**
+ * Alter audit policy statement.
+ */
+public abstract class AlterAuditPolicyStatement extends AbstractSQLStatement implements DDLStatement {
+}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleAlterAuditPolicyStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleAlterAuditPolicyStatement.java
new file mode 100644
index 00000000000..167281f9cab
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleAlterAuditPolicyStatement.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.ddl.AlterAuditPolicyStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.OracleStatement;
+
+/**
+ * Oracle alter audit policy statement.
+ */
+@ToString
+public final class OracleAlterAuditPolicyStatement extends AlterAuditPolicyStatement 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 1be9eda24ca..aa36b422994 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
@@ -112,6 +112,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.AlterIndexStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterInmemoryJoinGroupStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterJavaStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterAuditPolicyStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterLanguageStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterLibraryStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterMaterializedViewStatementTestCase;
@@ -1326,6 +1327,9 @@ public final class SQLParserTestCases {
@XmlElement(name = "alter-java")
private final List<AlterJavaStatementTestCase> alterJavaTestCases = new LinkedList<>();
+ @XmlElement(name = "alter-audit-policy")
+ private final List<AlterAuditPolicyStatementTestCase> alterAuditPolicyTestCases = new LinkedList<>();
+
@XmlElement(name = "alter-operator")
private final List<AlterOperatorStatementTestCase> alterOperatorTestCases = new LinkedList<>();
@@ -1857,6 +1861,7 @@ public final class SQLParserTestCases {
putAll(alterGroupTestCases, result);
putAll(alterMaterializedViewTestCases, result);
putAll(alterJavaTestCases, result);
+ putAll(alterAuditPolicyTestCases, result);
putAll(alterOperatorTestCases, result);
putAll(createTextSearchTestCases, result);
putAll(alterTextSearchTestCases, result);
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/AlterAuditPolicyStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/AlterAuditPolicyStatementTestCase.java
new file mode 100644
index 00000000000..443818eafc3
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/AlterAuditPolicyStatementTestCase.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 audit policy statement test case.
+ */
+public final class AlterAuditPolicyStatementTestCase extends SQLParserTestCase {
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-audit-policy.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-audit-policy.xml
new file mode 100644
index 00000000000..8ca8f8a531f
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-audit-policy.xml
@@ -0,0 +1,23 @@
+<?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-audit-policy sql-case-id="alter_audit_policy_add" />
+ <alter-audit-policy sql-case-id="alter_audit_policy_drop" />
+ <alter-audit-policy sql-case-id="alter_audit_policy_modify" />
+</sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-audit-policy.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-audit-policy.xml
new file mode 100644
index 00000000000..88e472119bb
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/alter-audit-policy.xml
@@ -0,0 +1,23 @@
+<?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_audit_policy_add" value="ALTER AUDIT POLICY dml_pol ADD PRIVILEGES CREATE ANY TABLE, DROP ANY TABLE;" db-types="Oracle" />
+ <sql-case id="alter_audit_policy_drop" value="ALTER AUDIT POLICY table_pol DROP PRIVILEGES CREATE ANY TABLE;" db-types="Oracle" />
+ <sql-case id="alter_audit_policy_modify" value="ALTER AUDIT POLICY emp_updates_pol CONDITION UID = 102 EVALUATE PER STATEMENT;" db-types="Oracle" />
+</sql-cases>