易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 2372|回复: 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';2 Q: g2 j- w% J/ N
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+0 ~& g- q+ |/ v- ]
| id                                   | volume_id                            | user_id                          | status    | display_name |3 l- W1 W( B% Y% K8 ]# N
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
, W$ B( g$ Y; b% H+ s& v2 a: ?| 71146765-659d-47c9-9682-5e077461f6ba | ff5717c6-301d-48a3-9833-9b1722557903 | 07ccc7c9772349a582e20f1e0ad5b054 | available | test1snap2   |$ g' N) U/ ?, s" v& Z2 l+ y: s7 ~9 M
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+7 k. w1 P3 {* K/ }
% i* X" k$ ^+ V2 o* c  m9 e, `
; n$ e. K  C, m" T8 U
mysql -ucinder -p cinder  -h192.168.6.233# c* F2 Y3 e, J' |, t" e! o
Enter password: + q: ]7 U  P; D1 N$ P! G: W
Reading table information for completion of table and column names( S+ ~2 b7 z" K9 g1 p
You can turn off this feature to get a quicker startup with -A
6 ~9 i  o. t6 V- y/ G! f6 ^/ {. k5 x- M" N- `
Welcome to the MariaDB monitor.  Commands end with ; or \g.# k8 V7 ?' {% t2 c  n1 g4 \
Your MariaDB connection id is 157266
) U, y. P: f$ p9 i3 G+ k) ZServer version: 10.1.20-MariaDB MariaDB Server% b: _" g! {) H. i$ i; @' U
4 N& c# _" w, x
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  R. l7 l. W5 I8 X1 b
0 D8 S% J! `7 K; |- F) dType 'help;' or '\h' for help. Type '\c' to clear the current input statement.! Q! _/ L/ Z/ v& O" S8 j
" }9 w$ u! Y. J: b9 ?# ?
MariaDB [cinder]>
* x6 A2 Z: J! F/ C3 C& T; @MariaDB [cinder]> select id,volume_id,user_id,status,display_name from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';
0 q  h% k* R8 ^, c, @. F+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
' r4 g1 ?2 H" a; e- |; r9 f6 \5 {| id                                   | volume_id                            | user_id                          | status    | display_name |" r* _# o# T5 W! E7 B8 S4 {
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
/ u" B" Y1 O" }: s: Q, T+ z| 6fdd4a5d-fb65-46bf-80c1-2716c5b4834a | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | 07ccc7c9772349a582e20f1e0ad5b054 | available | test2snap12  |: Y7 f: }2 ~* I
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+6 h' G4 Z6 [8 W0 {8 v
1 row in set (0.00 sec)- d0 N! j' A7 x2 f2 n% m: }
8 P$ U/ N. i  M9 A7 m7 c
MariaDB [cinder]> select * from volume_glance_metadata where volume_id = '8ac8ded1-2ade-46de-8c2f-75ec9bf194af';8 Q) \6 `' A- p9 G8 b' l
+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+
. u7 Y0 y- J4 J- O| created_at          | updated_at | deleted_at | deleted | id | volume_id                            | snapshot_id | key              | value                                |0 X: y& K* E9 c; h* u5 Y8 k
+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+
8 A, G) \7 F- p0 {# D2 `9 h| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 51 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | container_format | bare                                 |' j+ e6 g9 p/ R& W2 {0 M. j
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 54 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | min_ram          | 0                                    |
% B$ }) U$ o9 T' _$ W| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 57 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | disk_format      | raw                                  |
5 \) C' A& F( V. ^! H| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 60 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | image_name       | cirros-0.4                           |7 R8 d8 M8 r3 O% X" {
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 63 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | image_id         | 5062aa42-bb5e-4793-964f-b6dcc61d5fc6 |  E3 V9 S0 r3 o6 g
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 66 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | checksum         | 443b7623e27ecf03dc9e01ee93f67afe     |- ]  t0 `! e6 v: Z8 C# U0 r
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 69 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | min_disk         | 0                                    |% s) |" t! S% w- n' k4 {
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 72 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | size             | 12716032                             |
/ d5 h; v3 w& ?' R; Q* p/ R- D. l9 u+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+2 f( J( F2 Q% }+ z' I
7 s& @, Q/ M5 g. `) W" s9 }
8 rows in set (0.00 sec)
% P6 x& D4 g: W1 W( N5 F$ P- S, q1 U1 x% v0 W  }
% }9 C4 ]3 @% z
MariaDB [cinder]> delete from volume_glance_metadata where id='51';* r$ a7 x* P4 h8 _$ W1 z4 T5 s% a
Query OK, 1 row affected (0.00 sec)
7 t; R" M! K' |/ h7 k# @/ l1 W
! G9 q7 R- J" ^  OMariaDB [cinder]> delete from volume_glance_metadata where id='54';- k& [# N6 p# E/ K9 L- `
Query OK, 1 row affected (0.00 sec): Y, ^, A; d/ G; }7 _6 N
, O9 W) B( |! S9 j
MariaDB [cinder]> delete from volume_glance_metadata where id='57';
# E+ k5 N' S9 ]7 W9 n! QQuery OK, 1 row affected (0.00 sec)
, |' {1 L# P3 j' a. p' C" I5 C; E& R7 k
MariaDB [cinder]> delete from volume_glance_metadata where id='60';
* ~: E6 D8 J: n4 \" p! r9 bQuery OK, 1 row affected (0.00 sec)) o! p, I4 }0 z8 z

  X4 u- q) p- E6 o. h" M5 ZMariaDB [cinder]> delete from volume_glance_metadata where id='63';
' p6 K) R5 ~. Y# _  mQuery OK, 1 row affected (0.00 sec)+ V; J# A" Q3 ]. ~! S  D& @
9 V+ @8 q' b: z+ U. x
MariaDB [cinder]> delete from volume_glance_metadata where id='66';5 s1 N& v) V% W: K* x" i2 t& s# Q0 I
Query OK, 1 row affected (0.00 sec)4 ?1 ]" W: _# a8 M
2 l6 k! ~4 k  C1 P
MariaDB [cinder]> delete from volume_glance_metadata where id='69';' @1 g0 V5 R/ H2 N# V+ L- Z
Query OK, 1 row affected (0.01 sec)
# X+ N; e+ v! a9 e! Y8 H4 ~/ P, c/ a" _. {$ d5 b; Q6 y; [( Y
MariaDB [cinder]> delete from volume_glance_metadata where id='72';& X0 W+ ~  N  Q% j, C  ^/ z
Query OK, 1 row affected (0.01 sec), d+ J% n9 w9 }: v

, [' A3 ?9 ~$ P: N1 G
4 x1 B0 h$ E% p, EMariaDB [cinder]> delete from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';
1 c; P* H* M, g  U) 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`))
, j2 r; \7 }3 G5 p" i& x4 N' tMariaDB [cinder]> delete from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';, E' N4 N" d) G4 k" j- d1 j. W; u, f
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`))
8 [9 a$ P- T  [5 C: b* G+ o( {5 W' uMariaDB [cinder]> delete from snapshots where volume_id= '8ac8ded1-2ade-46de-8c2f-75ec9bf194af';' z" A" N+ `( g( t) \
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`))! X. J1 {& e7 b8 z! h
MariaDB [cinder]> 8 E/ z( C( G3 X0 b6 p
0 r. m$ J* t2 V' n' F8 e- H

0 X, Z* c% F2 Z, `$ B7 \
! ?* Z8 v; L% g3 @' @" U, A1 Y% h7 \# N# ^( a" _
 楼主| 发表于 2021-5-19 17:25:49 | 显示全部楼层
未找到原因,通过界面可以删除。建议不要随便删除数据库数据,否则会导致数据库缺少数据字段。
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

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

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

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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