易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 2371|回复: 1
收起左侧

数据查询删除snapshots数据库命令和步骤

[复制链接]
发表于 2021-5-19 15:49:39 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
MariaDB [cinder]> select id,volume_id,user_id,status,display_name from snapshots where id= '71146765-659d-47c9-9682-5e077461f6ba';
8 }0 d4 {0 E1 T2 V0 B; ]+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+* T% w. g  e6 I4 x
| id                                   | volume_id                            | user_id                          | status    | display_name |
3 K" A/ y+ _" a0 V" _. V5 ^; L- M+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
4 }& S- C( W& B& R- q| 71146765-659d-47c9-9682-5e077461f6ba | ff5717c6-301d-48a3-9833-9b1722557903 | 07ccc7c9772349a582e20f1e0ad5b054 | available | test1snap2   |
3 `0 h$ K9 o6 `8 l. \+ J, O3 s+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+* [- i3 g; E9 y7 d9 V2 U1 G1 b
- y/ F- ?  o6 e: m2 H# ^* H  I" @
$ J) s# z3 S7 `9 i. ^
mysql -ucinder -p cinder  -h192.168.6.233* B, a  T; s9 V# y. U9 p
Enter password:
& m5 f5 x5 h( C: v5 dReading table information for completion of table and column names9 X' q! D" v, t. ]- c7 h
You can turn off this feature to get a quicker startup with -A1 R. E; M+ w* V' S/ N- e0 l6 {

$ d  {, F* `# z  C: @Welcome to the MariaDB monitor.  Commands end with ; or \g.
/ j6 F% k0 K# mYour MariaDB connection id is 1572664 C# i% o$ j& @! x" }
Server version: 10.1.20-MariaDB MariaDB Server
8 i, Z6 @: ^" \6 {9 Z1 Z& X# ^3 `* J1 |% o7 b  z) d7 j5 h0 q
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
; T! Z9 S: {4 U$ U9 _" V0 |, O* l; H3 u$ W1 u, \" a
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
( Z2 Y8 A7 f/ O' }! j1 h$ o" [6 D! R' d/ b
MariaDB [cinder]> 8 @' k8 F6 O. J" ^
MariaDB [cinder]> select id,volume_id,user_id,status,display_name from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';, R, |- w: X! t. V& X/ \" _
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
4 O3 p, x) ^6 K- \| id                                   | volume_id                            | user_id                          | status    | display_name |$ R. F1 W9 q2 F& p
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
$ X8 V7 s' l% X| 6fdd4a5d-fb65-46bf-80c1-2716c5b4834a | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | 07ccc7c9772349a582e20f1e0ad5b054 | available | test2snap12  |; v5 u0 K6 D3 x1 ?6 G+ c5 }
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+$ D) X, r% ~0 c) i7 M1 L7 V( z+ v* j
1 row in set (0.00 sec)
5 B- @  S- f" u2 w4 c/ |' L* S
% p+ r0 V- g8 KMariaDB [cinder]> select * from volume_glance_metadata where volume_id = '8ac8ded1-2ade-46de-8c2f-75ec9bf194af';
' `2 B; @# \7 J, @3 ^+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+, P2 l# ^; m8 U) p' E. {  |9 s
| created_at          | updated_at | deleted_at | deleted | id | volume_id                            | snapshot_id | key              | value                                |
! B" |, N- T' x( R$ d+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+3 u$ z/ f4 h* k! J
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 51 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | container_format | bare                                 |5 J( r0 @! I& C$ Z
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 54 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | min_ram          | 0                                    |
$ B' U8 w3 q3 ]3 U| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 57 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | disk_format      | raw                                  |) u9 U! L7 x1 Q1 d8 M* n) K
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 60 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | image_name       | cirros-0.4                           |
) K* I% ?! l) h. D4 f  `+ e| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 63 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | image_id         | 5062aa42-bb5e-4793-964f-b6dcc61d5fc6 |) e* e1 a% o; \4 q6 k7 V
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 66 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | checksum         | 443b7623e27ecf03dc9e01ee93f67afe     |2 V7 C: T$ q* @* E" x" b
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 69 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | min_disk         | 0                                    |) l6 Z/ [  p% G  N0 e; Q* X0 I
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 72 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | size             | 12716032                             |5 A; W- Z, \; h$ ?
+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+* S2 S; G; _' d( u7 p: @# a  |. M

  s" P$ ~1 L7 N9 b5 H; N( c8 rows in set (0.00 sec)
7 q+ I1 V! L: b
# y+ h8 i( S1 [/ ~: A+ s& @% Y! t* @3 I1 Q
MariaDB [cinder]> delete from volume_glance_metadata where id='51';
4 Y# L$ Z" n! ~( q* R/ A. \/ LQuery OK, 1 row affected (0.00 sec)
) ^4 S* L7 \; W" y3 X. `2 i2 m  |* e. q0 q8 I  @/ X# q3 I. X  Y' B
MariaDB [cinder]> delete from volume_glance_metadata where id='54';! q9 M, @. H3 O, P' c
Query OK, 1 row affected (0.00 sec)) }1 `2 s. M- E
( c% U* ~9 d) ~; E# T
MariaDB [cinder]> delete from volume_glance_metadata where id='57';
& l" g0 {3 S4 BQuery OK, 1 row affected (0.00 sec)
+ K( a0 ]5 F8 g& @2 ~. t- z1 c+ J% b' Y3 o. e+ b5 s0 M
MariaDB [cinder]> delete from volume_glance_metadata where id='60';# v" ~" ?/ R  q4 @1 c3 a
Query OK, 1 row affected (0.00 sec); D0 r0 |* }% ~4 v

8 y8 C! Z. A3 T' VMariaDB [cinder]> delete from volume_glance_metadata where id='63';+ T$ o+ d9 C9 \6 z4 h& C$ E
Query OK, 1 row affected (0.00 sec)7 a5 f0 t2 n( J& o9 _

2 f; [9 f3 {% c: `MariaDB [cinder]> delete from volume_glance_metadata where id='66';
7 K5 |5 i+ }8 i" E- \3 UQuery OK, 1 row affected (0.00 sec)( V0 Q+ }6 o6 R& n- D# O
) ~+ E% q! ^+ l, H. _2 L7 K  {
MariaDB [cinder]> delete from volume_glance_metadata where id='69';5 h9 \4 I8 M2 T% {( H  V
Query OK, 1 row affected (0.01 sec)
4 J: N2 ~- y0 R5 Q5 x6 |7 h4 q7 L4 k$ g/ U$ L1 X* o
MariaDB [cinder]> delete from volume_glance_metadata where id='72';
! C5 a- b- A- H- iQuery OK, 1 row affected (0.01 sec)
3 g- x+ l. i+ v7 Z7 O6 @
. g. x3 J# Q9 u9 Z4 X) _5 ]
( q9 _3 t' p! q2 P: R5 a5 XMariaDB [cinder]> delete from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';5 c5 I  u% N* p+ o$ D3 \2 m
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cinder`.`volume_glance_metadata`, CONSTRAINT `volume_glance_metadata_ibfk_2` FOREIGN KEY (`snapshot_id`) REFERENCES `snapshots` (`id`))( m) v9 k9 n1 a6 Z+ a
MariaDB [cinder]> delete from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';
/ H9 ~5 D' {5 r4 g( T9 @ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cinder`.`volume_glance_metadata`, CONSTRAINT `volume_glance_metadata_ibfk_2` FOREIGN KEY (`snapshot_id`) REFERENCES `snapshots` (`id`)): ?& t7 ^+ H2 k0 ^. y; _
MariaDB [cinder]> delete from snapshots where volume_id= '8ac8ded1-2ade-46de-8c2f-75ec9bf194af';
* B0 ^( _( o7 k5 LERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cinder`.`volume_glance_metadata`, CONSTRAINT `volume_glance_metadata_ibfk_2` FOREIGN KEY (`snapshot_id`) REFERENCES `snapshots` (`id`))4 N# Z# r: b6 O9 b% A
MariaDB [cinder]> . E2 I5 [5 M* F0 V

8 Z  `$ t' h1 B7 {! D# C* R& C
0 ~- u. S1 C4 y7 U% ?% T& X5 ^. _/ H$ v
- S% E( R4 w7 R1 Z. A* R3 V
 楼主| 发表于 2021-5-19 17:25:49 | 显示全部楼层
未找到原因,通过界面可以删除。建议不要随便删除数据库数据,否则会导致数据库缺少数据字段。
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 20:23 , Processed in 0.049974 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表