diff --git a/CN/modules/ROOT/pages/4.5.adoc b/CN/modules/ROOT/pages/4.5.adoc index 9c7c0ee9..b2bb6831 100644 --- a/CN/modules/ROOT/pages/4.5.adoc +++ b/CN/modules/ROOT/pages/4.5.adoc @@ -497,7 +497,7 @@ CREATE ROLE 由于有物化视图,在TABLE_sh.sql 里包含了物化视图的索引,会创建失败。需先创建表,在创建物化视图,最后创建索引。 -取消物化视图索引,后面单独创建: +从 `TABLE_sh.sql` 中移除物化视图索引,将编辑后的表结构脚本保存为 `tab.sql`。导入物化视图后,再创建暂缓的索引。 ``` CREATE INDEX fw_psc_s_mv_chan_bix ON fweek_pscat_sales_mv (channel_id); @@ -513,7 +513,7 @@ ALTER TEXT SEARCH CONFIGURATION en ALTER MAPPING FOR hword, hword_part, word WIT ``` ``` -psql orcl -f tab.sql +psql -v ON_ERROR_STOP=1 -d orcl -f tab.sql ALTER TABLE PARTITION sh.sales OWNER TO sh; COMMENT @@ -531,13 +531,19 @@ ALTER TABLE === 给对象授权 +检查 `GRANT_sh.sql`,使其适合目标库已经存在的角色和对象。以下为生成的 SQL 节选。 + ``` -cat psql orcl -f GRANT_sh.sql CREATE USER SH WITH PASSWORD 'change_my_secret' LOGIN; ALTER TABLE sh.fweek_pscat_sales_mv OWNER TO sh; GRANT ALL ON sh.fweek_pscat_sales_mv TO sh; ``` +[source,sh] +---- +psql -v ON_ERROR_STOP=1 -d orcl -f GRANT_sh.sql +---- + === 导入物化视图结构 物化视图需要相关查询权限,所以导入权限,注意这里要跟上用户 diff --git a/EN/modules/ROOT/pages/4.5.adoc b/EN/modules/ROOT/pages/4.5.adoc index 4591ac15..1e027546 100644 --- a/EN/modules/ROOT/pages/4.5.adoc +++ b/EN/modules/ROOT/pages/4.5.adoc @@ -507,7 +507,7 @@ CREATE ROLE === Import table structure Because of the materialized view, in TABLE_ The sh.sql contains the index of the materialized view, which will fail to create. You need to first create a table, then create a materialized view, and finally create an index. -Cancel the materialized view index and create it separately later: +Edit `TABLE_sh.sql` to remove the materialized-view indexes and save this table-only script as `tab.sql`. Create the deferred indexes after importing the materialized views. ``` CREATE INDEX fw_psc_s_mv_chan_bix ON fweek_pscat_sales_mv (channel_id); @@ -523,7 +523,7 @@ ALTER TEXT SEARCH CONFIGURATION en ALTER MAPPING FOR hword, hword_part, word WIT ``` ``` -psql orcl -f tab.sql.sql +psql -v ON_ERROR_STOP=1 -d orcl -f tab.sql ALTER TABLE PARTITION sh.sales OWNER TO sh; COMMENT @@ -541,13 +541,19 @@ ALTER TABLE === Authorize objects +Review `GRANT_sh.sql` for the roles and objects already present on the target. The following is an excerpt of the generated SQL. + ``` -cat psql orcl -f GRANT_sh.sql CREATE USER SH WITH PASSWORD 'change_my_secret' LOGIN; ALTER TABLE sh.fweek_pscat_sales_mv OWNER TO sh; GRANT ALL ON sh.fweek_pscat_sales_mv TO sh; ``` +[source,sh] +---- +psql -v ON_ERROR_STOP=1 -d orcl -f GRANT_sh.sql +---- + === Import materialized view structure Materialized views require relevant query permissions, so import permissions. Please keep up with users here