Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions CN/modules/ROOT/pages/4.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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
----

=== 导入物化视图结构

物化视图需要相关查询权限,所以导入权限,注意这里要跟上用户
Expand Down
12 changes: 9 additions & 3 deletions EN/modules/ROOT/pages/4.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading