create the volume group and activate it

本文介绍如何通过命令行创建卷组,包括创建目录、控制文件、指定物理卷等步骤,并验证创建结果。

To create the volume group and activate it, enter commands similar to the following:

# /sbin/mknod /dev/vg_name/group c 64 0xnn0000

# /sbin/vgcreate /dev/vg_name /dev/dsk/cxtydz . . .

# /sbin/vgchange -a y vg_name

In this example:

vg_name is the name that you want to give to the volume group

0xnn0000 is a minor number that is unused on all nodes in the cluster

/dev/dsk/cxtydz... is a list of one or more block device names for the disks that you want to add to the volume group

1,为卷组创建一个目录,比如:

# mkdir /dev/vg01

2,为组创建一个控制文件:

# mknod /dev/vg01/group c 64 0x10000

3,创建卷组并指定它包含的物理卷:

# vgcreate /dev/vg01 /dev/dsk/c0t3d0 /dev/dsk/c0t4d0

4,vgdisplay命令查看是否创建成功:

# vgdisplay -v vg01

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22934571/viewspace-1048605/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/22934571/viewspace-1048605/

怎么优化 这个执行函数 CREATE DEFINER=`root`@`%` PROCEDURE `sync_customer_reconstruction`() BEGIN #Routine body goes here... -- 定义批次大小和起始点 SET @batch_size = 10000; SET @min_id = (SELECT MIN(customer_id) FROM t_customer_info where delmark = 1); SET @max_id = (SELECT MAX(customer_id) FROM t_customer_info where delmark = 1); -- 循环处理每个批次 WHILE @min_id <= @max_id DO START TRANSACTION; -- 复制当前批次数据到新表 INSERT INTO customer_basic_info_sync1( id, customer_name, customer_tel, customer_num, is_box, open_id, first_customer_num, shop_id, private_customer_id, platform, first_arrival_date, create_time, create_by, update_time, update_by, delmark ) SELECT customer_id, customer_name, customer_tel, customer_num, is_box, open_id, first_customer_num, agent_id, case when hq_agent_id =0 then null else hq_agent_id end as private_customer_id, platform, customer_date, create_time, create_by, update_time, update_by, delmark FROM t_customer_info WHERE customer_id BETWEEN @min_id AND @min_id + @batch_size - 1 and delmark = 1; INSERT INTO customer_stat_info_sync1 ( customer_id, upgrade_plan, rendering_count, order_count, order_price, consume_price, arrival_count, first_buy_time, last_buy_time, last_active_time, refund_exists, create_time, create_by, update_time, update_by, delmark ) SELECT customer_id, upgrade_plan, rendering_count, order_count, order_price, consume_price, arrival_count, first_buy_time, last_buy_time, last_active_time, refund_exists, create_time, create_by, update_time, update_by, delmark FROM t_customer_info WHERE customer_id BETWEEN @min_id AND @min_id + @batch_size - 1 and delmark = 1; INSERT INTO customer_product_branch_stats_sync1 ( customer_id, type, count, create_time, create_by, update_time, update_by, delmark ) SELECT CUSTOMER_ID AS CUSTOMER_ID, types.type, CASE types.type WHEN '1' THEN wuze_branch_count WHEN '2' THEN fangtuo_branch_count WHEN '3' THEN donggan_branch_count WHEN '4' THEN cc_branch_count END AS count, create_time, create_by, update_time, update_by, delmark FROM t_customer_info CROSS JOIN ( -- 构建类型映射表 SELECT '1' AS type UNION ALL SELECT '2' UNION ALL SELECT '3' UNION ALL SELECT '4' ) AS types WHERE customer_id BETWEEN @min_id AND @min_id + @batch_size - 1 and delmark = 1; INSERT INTO customer_hair_profile_sync1 ( customer_id, question, hair_volume, hair_condition, willingness_to_improve, white_hair_count, frequency, hair_loss_count, grey_time, create_time, create_by, update_time, update_by, delmark ) SELECT customer_id, question, hair_volume, hair_condition, willingness_to_improve, white_hair_count, frequency, hair_loss_count, grey_time, create_time, create_by, update_time, update_by, delmark FROM t_customer_info WHERE customer_id BETWEEN @min_id AND @min_id + @batch_size - 1 and delmark = 1; INSERT INTO customer_status_info_sync1 ( customer_id, major, activate, major_date, is_scan, customer_level, old_customer_time, create_time, create_by, update_time, update_by, delmark ) SELECT t.customer_id, t.major, t.activate, t.major_date, is_scan, customer_level, old_customer_time, create_time, create_by, update_time, update_by, delmark FROM t_customer_info t WHERE customer_id BETWEEN @min_id AND @min_id + @batch_size - 1 and delmark = 1; INSERT INTO customer_follow_info_sync1 ( customer_id, follow_user_id, check_user_id, voice_record_user_id, voice_record_date, create_time, create_by, update_time, update_by, delmark ) SELECT customer_id, follow_user_id, check_user_id, voice_record_user_id, voice_record_date, create_time, create_by, update_time, update_by, delmark FROM t_customer_info WHERE customer_id BETWEEN @min_id AND @min_id + @batch_size - 1 and delmark = 1; INSERT INTO customer_ext_info ( customer_id, sex, customer_age, birthday_type, birthday, travel_mode, car_model, marital_status, physiology, hobby, home_info, beauty_items, care_preference, taboo, address, occupation, improvement_rate, remark, create_time, create_by, update_time, update_by, delmark ) SELECT t.customer_id, sex, customer_age, birthday_type, birthday, travel_mode, car_model, marital_status, physiology, hobby, home_info, beauty_items, care_preference, taboo, address, occupation, improvement_rate, c.remark, c.create_time, c.create_by, c.update_time, c.update_by, c.delmark FROM t_customer_info t LEFT JOIN t_customer_ext_info c on c.customer_id = t.customer_id and c.delmark = 1 WHERE t.customer_id BETWEEN @min_id AND @min_id + @batch_size - 1 and t.delmark = 1; -- 数据一致性校验:检查行数是否匹配 SET @basic_info_count = (SELECT COUNT(1) FROM customer_basic_info_sync1 WHERE delmark = 1 AND id BETWEEN @min_id AND @min_id + @batch_size - 1); SET @stat_info_count = (SELECT COUNT(1) FROM customer_stat_info_sync1 WHERE delmark = 1 AND customer_id BETWEEN @min_id AND @min_id + @batch_size - 1); SET @product_branch_stats_count = (SELECT count(1) from ( select customer_id FROM customer_product_branch_stats_sync1 WHERE delmark = 1 AND customer_id BETWEEN @min_id AND @min_id + @batch_size - 1 GROUP BY customer_id) c ); SET @hair_profile_count = (SELECT COUNT(1) FROM customer_hair_profile_sync1 WHERE delmark = 1 AND customer_id BETWEEN @min_id AND @min_id + @batch_size - 1); SET @status_info_count = (SELECT COUNT(1) FROM customer_status_info_sync1 WHERE delmark = 1 AND customer_id BETWEEN @min_id AND @min_id + @batch_size - 1); SET @follow_info_count = (SELECT COUNT(1) FROM customer_follow_info_sync1 WHERE delmark = 1 AND customer_id BETWEEN @min_id AND @min_id + @batch_size - 1); SET @ext_info_count = (SELECT COUNT(*) FROM customer_ext_info WHERE delmark = 1 AND customer_id BETWEEN @min_id AND @min_id + @batch_size - 1); SET @original_count = (SELECT COUNT(*) FROM t_customer_info WHERE delmark = 1 AND customer_id BETWEEN @min_id AND @min_id + @batch_size - 1); -- 如果校验失败,回滚事务 IF @basic_count != @original_count OR @stat_info_count != @original_count OR @product_branch_stats_count != @original_count OR @hair_profile_count != @original_count OR @status_info_count != @original_count OR @ext_info_count != @original_count OR @follow_info_count != @original_count THEN ROLLBACK; SELECT @min_id,@min_id + @batch_size - 1,'This is a log error message' AS LogMessage; SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Data inconsistency detected, rolled back batch'; ELSE COMMIT; END IF; -- 更新批次起始点 SET @min_id = @min_id + @batch_size; END WHILE; -- 释放表锁 -- UNLOCK TABLES; END
10-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值