This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch ranger-2.6
in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/ranger-2.6 by this push:
new 4294f3b2b RANGER-5002: fix schema creation/migration failures with
Oracle database
4294f3b2b is described below
commit 4294f3b2b3f529f855921dbd3b613335b875c9e9
Author: Madhan Neethiraj <[email protected]>
AuthorDate: Thu Dec 12 14:04:48 2024 -0800
RANGER-5002: fix schema creation/migration failures with Oracle database
(cherry picked from commit f501dfc7ef91d8e55f3a2c127815539039ab1f86)
---
kms/scripts/db_setup.py | 2 +-
.../db/oracle/optimized/current/ranger_core_db_oracle.sql | 7 ++++---
security-admin/db/oracle/patches/068-create-view-principal.sql | 6 +++---
security-admin/db/oracle/patches/073-create-x_trx_log_v2.sql | 1 +
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/kms/scripts/db_setup.py b/kms/scripts/db_setup.py
index ae4d811c6..f29af9f8d 100644
--- a/kms/scripts/db_setup.py
+++ b/kms/scripts/db_setup.py
@@ -720,7 +720,7 @@ def main(argv):
elif XA_DB_FLAVOR == "ORACLE":
ORACLE_CONNECTOR_JAR=globalDict['SQL_CONNECTOR_JAR']
- xa_sqlObj = OracleConf(xa_db_host, ORACLE_CONNECTOR_JAR,
JAVA_OPTS, JAVA_BIN)
+ xa_sqlObj = OracleConf(xa_db_host, ORACLE_CONNECTOR_JAR,
JAVA_OPTS, JAVA_BIN, is_override_db_connection_string,
db_override_jdbc_connection_string)
xa_db_core_file = os.path.join(RANGER_KMS_HOME
,oracle_core_file)
elif XA_DB_FLAVOR == "POSTGRES":
diff --git
a/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
b/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
index 7912eeceb..40f71e28b 100644
--- a/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
+++ b/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
@@ -566,6 +566,7 @@ CREATE TABLE x_trx_log_v2 (
parent_object_id NUMBER(20) DEFAULT NULL NULL ,
parent_object_class_type NUMBER(11) DEFAULT '0' NOT NULL ,
parent_object_name VARCHAR(1024) DEFAULT NULL NULL ,
+ object_name varchar(1024) DEFAULT NULL NULL,
change_info CLOB DEFAULT NULL NULL ,
trx_id VARCHAR(1024) DEFAULT NULL NULL ,
action VARCHAR(255) DEFAULT NULL NULL ,
@@ -1903,9 +1904,9 @@ CONSTRAINT x_rms_map_provider_UK_name UNIQUE(name)
);
CREATE VIEW vx_principal as
- (SELECT u.user_name AS principal_name, 0 AS principal_type, u.status status,
u.is_visible is_visible, u.other_attributes other_attributes, u.create_time
create_time, u.update_time update_time, u.added_by_id added_by_id, u.upd_by_id
upd_by_id FROM x_user u) UNION
- (SELECT g.group_name principal_name, 1 AS principal_type, g.status status,
g.is_visible is_visible, g.other_attributes other_attributes, g.create_time
create_time, g.update_time update_time, g.added_by_id added_by_id, g.upd_by_id
upd_by_id FROM x_group g) UNION
- (SELECT r.name principal_name, 2 AS principal_name, 1 status, 1 is_visible,
null other_attributes, r.create_time create_time, r.update_time update_time,
r.added_by_id added_by_id, r.upd_by_id upd_by_id FROM x_role r);
+ (SELECT u.user_name AS principal_name, 0 AS principal_type, u.status AS
status, u.is_visible AS is_visible, u.other_attributes AS other_attributes,
u.create_time AS create_time, u.update_time AS update_time, u.added_by_id AS
added_by_id, u.upd_by_id AS upd_by_id FROM x_user u) UNION ALL
+ (SELECT g.group_name AS principal_name, 1 AS principal_type, g.status AS
status, g.is_visible AS is_visible, g.other_attributes AS other_attributes,
g.create_time AS create_time, g.update_time AS update_time, g.added_by_id AS
added_by_id, g.upd_by_id AS upd_by_id FROM x_group g) UNION ALL
+ (SELECT r.name AS principal_name, 2 AS principal_type, 1 AS
status, 1 AS is_visible, null AS other_attributes,
r.create_time AS create_time, r.update_time AS update_time, r.added_by_id AS
added_by_id, r.upd_by_id AS upd_by_id FROM x_role r);
commit;
commit;
diff --git a/security-admin/db/oracle/patches/068-create-view-principal.sql
b/security-admin/db/oracle/patches/068-create-view-principal.sql
index 90ff1eb36..d57f9b8dd 100644
--- a/security-admin/db/oracle/patches/068-create-view-principal.sql
+++ b/security-admin/db/oracle/patches/068-create-view-principal.sql
@@ -16,8 +16,8 @@
call spdropview('vx_principal');
CREATE VIEW vx_principal as
- (SELECT u.user_name AS principal_name, 0 AS principal_type, u.status
status, u.is_visible is_visible, u.other_attributes other_attributes,
u.create_time create_time, u.update_time update_time, u.added_by_id
added_by_id, u.upd_by_id upd_by_id FROM x_user u) UNION
- (SELECT g.group_name principal_name, 1 AS principal_type, g.status
status, g.is_visible is_visible, g.other_attributes other_attributes,
g.create_time create_time, g.update_time update_time, g.added_by_id
added_by_id, g.upd_by_id upd_by_id FROM x_group g) UNION
- (SELECT r.name principal_name, 2 AS principal_name, 1 status, 1
is_visible, null other_attributes, r.create_time create_time, r.update_time
update_time, r.added_by_id added_by_id, r.upd_by_id upd_by_id FROM x_role r);
+ (SELECT u.user_name AS principal_name, 0 AS principal_type, u.status
AS status, u.is_visible AS is_visible, u.other_attributes AS other_attributes,
u.create_time AS create_time, u.update_time AS update_time, u.added_by_id AS
added_by_id, u.upd_by_id AS upd_by_id FROM x_user u) UNION ALL
+ (SELECT g.group_name AS principal_name, 1 AS principal_type, g.status
AS status, g.is_visible AS is_visible, g.other_attributes AS other_attributes,
g.create_time AS create_time, g.update_time AS update_time, g.added_by_id AS
added_by_id, g.upd_by_id AS upd_by_id FROM x_group g) UNION ALL
+ (SELECT r.name AS principal_name, 2 AS principal_type, 1
AS status, 1 AS is_visible, null AS other_attributes,
r.create_time AS create_time, r.update_time AS update_time, r.added_by_id AS
added_by_id, r.upd_by_id AS upd_by_id FROM x_role r);
commit;
diff --git a/security-admin/db/oracle/patches/073-create-x_trx_log_v2.sql
b/security-admin/db/oracle/patches/073-create-x_trx_log_v2.sql
index 46c9489e1..b7da58c0e 100644
--- a/security-admin/db/oracle/patches/073-create-x_trx_log_v2.sql
+++ b/security-admin/db/oracle/patches/073-create-x_trx_log_v2.sql
@@ -28,6 +28,7 @@ CREATE TABLE x_trx_log_v2 (
parent_object_id NUMBER(20) DEFAULT NULL NULL ,
parent_object_class_type NUMBER(11) DEFAULT '0' NOT NULL ,
parent_object_name VARCHAR(1024) DEFAULT NULL NULL ,
+ object_name varchar(1024) DEFAULT NULL NULL,
change_info CLOB DEFAULT NULL NULL ,
trx_id VARCHAR(1024) DEFAULT NULL NULL ,
action VARCHAR(255) DEFAULT NULL NULL ,